【IOS】修改TabBar属性

时间:2014-09-14 23:38:37   收藏:0   阅读:502
 1  if (IOS7) {
 2 
 3 
 4         //ios7下,tabbar选中的文字颜色
 5 
 6         _tabBarController.tabBar.tintColor = COLOR(245, 254, 0, 1);
 7 
 8     }
 9 
10     else {
11 
12         //ios6下,tabbar选中的文字颜色
13 
14         [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
15 
16                                                            COLOR(245, 254, 0, 1), UITextAttributeTextColor,nil]
17 
18                                                  forState:UIControlStateHighlighted];
19 
20     }
21     //修改tabbar背景图
22   _tabBarController.tabBar.backgroundImage = LOADPNGIMAGE(@"TabbarBG");
23 
24 
25 //修改选中和未选中的图片
26  [viewController.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@按下.png",imageArr[i]]] withFinishedUnselectedImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@弹起.png",imageArr[i]]]];

 

原文:http://www.cnblogs.com/DannyApple/p/3971926.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!