前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >标签栏代码

标签栏代码

作者头像
用户1451823
发布2018-09-13 17:19:04
5040
发布2018-09-13 17:19:04
举报
文章被收录于专栏:DannyHoo的专栏DannyHoo的专栏

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://cloud.tencent.com/developer/article/1338173

              - (void)customizeTabBarForController:(RDVTabBarController \*)tabBarController {     UIImage *finishedImage = UIImage imageNamed:@"tabbar_selected_background";
     UIImage *unfinishedImage = UIImage imageNamed:@"tabbar_normal_background";
     NSArray *tabBarItemImages = @@"tabbar_limitfree", @"tabbar_reduceprice", @"tabbar_appfree",@"tabbar_subject",@"tabbar_rank";
 

    NSArray *titles = @@"我的主页",@"粉丝列表",@"我的微博",@"关注列表",@"我的";

    NSInteger index = 0;

    NSDictionary *textAttributes_normal = nil;

    NSDictionary *textAttributes_selected = nil;

    if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) {

        textAttributes_normal = @{

                                  NSFontAttributeName: UIFont systemFontOfSize:12,

                                  NSForegroundColorAttributeName: UIColor colorWithRed:65/255.0 green:65/255.0 blue:65/255.0 alpha:1.0,

                                  };

        textAttributes_selected = @{

                                    NSFontAttributeName: UIFont systemFontOfSize:12,

                                    NSForegroundColorAttributeName: UIColor colorWithRed:14/255.0 green:154/255.0 blue:255/255.0 alpha:1.0,

                                    };

    }

    for (RDVTabBarItem *item in [tabBarController tabBar items]) {

        item.unselectedTitleAttributes = textAttributes_normal;

        item.selectedTitleAttributes = textAttributes_selected;

        item setBackgroundSelectedImage:finishedImage withUnselectedImage:unfinishedImage;

        UIImage *selectedimage = [UIImage imageNamed:[NSString stringWithFormat:@"%@_press",

                                                      tabBarItemImages objectAtIndex:index]];

        UIImage *unselectedimage = [UIImage imageNamed:[NSString stringWithFormat:@"%@",

                                                        tabBarItemImages objectAtIndex:index]];

        item setFinishedSelectedImage:selectedimage withFinishedUnselectedImage:unselectedimage;

        item.title = titlesindex;

        index++;

    }

}

 // 设置导航条的颜色

    [UINavigationBar appearance setBarTintColor:UIColor orangeColor];

    // 设置状态栏字体颜色

    application setStatusBarStyle:UIStatusBarStyleLightContent;

    // 设置导航栏title颜色和字体

    NSDictionary* textAttributes = @{

                                     NSFontAttributeName : UIFont systemFontOfSize:25,

                                     NSForegroundColorAttributeName : UIColor greenColor,

                                     };

    [UINavigationBar appearance setTitleTextAttributes:textAttributes];

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2015年10月04日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档