改变tabBarItem颜色

[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                       [UIColor blackColor], NSForegroundColorAttributeName,
                                                       nil] forState:UIControlStateNormal];
UIColor *titleHighlightedColor = [UIColor colorWithR:52 g:168 b:132 a:1];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: titleHighlightedColor, NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];

 上边是字体,下边是图片

[_secondVC.tabBarItem setImage:[[UIImage imageNamed:@"dianpu"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[_secondVC.tabBarItem setSelectedImage:[[UIImage imageNamed:@"dianpu02"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];

 

posted @ 2016-05-05 17:56  小屁孩~  阅读(365)  评论(0编辑  收藏  举报