码迷,mamicode.com
首页 > 移动开发 > 详细

iOS tabbar 属性

时间:2014-05-26 17:59:15      阅读:286      评论:0      收藏:0      [点我收藏+]

标签:style   c   class   blog   code   java   

1.设置tabbar背景颜色

bubuko.com,布布扣
1 NSArray *controllers = [NSArray arrayWithObjects:nav_main,nav_channle,nav_me, nil];
2     _tabController.viewControllers = controllers;
3     _tabController.delegate = self;
4     
5     for (int i=0;i<self.tabController.viewControllers.count;i++) {
6         UIViewController *viewController = [self.tabController.viewControllers objectAtIndex:i];
7         // 设置tabbar 背景颜色
8         [viewController.tabBarController.tabBar setBackgroundImage:[UIImage imageWithColor:kTabBarBackgroundColor]];
9     }
bubuko.com,布布扣

2.ios7.ios6选中 未选中颜色

 [[UITabBarItem appearance]setTitleTextAttributes:@{ UITextAttributeTextColor : cMainColor }
                                                forState:UIControlStateSelected];
        [[UITabBarItem appearance] setTitleTextAttributes:@{ UITextAttributeTextColor : cTabUnselect }
                                                 forState:UIControlStateNormal];

以下添加font属性

bubuko.com,布布扣
[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Bold" size:10.0f],
                                                    NSForegroundColorAttributeName : appTintColor
                                                    } forState:UIControlStateSelected];


// doing this results in an easier to read unselected state then the default iOS 7 one
[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Bold" size:10.0f],
                                                    NSForegroundColorAttributeName : [UIColor colorWithRed:.5 green:.5 blue:.5 alpha:1]
                                                    } forState:UIControlStateNormal];
bubuko.com,布布扣

 

iOS tabbar 属性,布布扣,bubuko.com

iOS tabbar 属性

标签:style   c   class   blog   code   java   

原文地址:http://www.cnblogs.com/lihaibo-Leao/p/3752586.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!