【IOS】修改TabBar属性

 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]]]];

 

posted @ 2014-09-14 23:00  Danny_吕昌辉  阅读(342)  评论(0编辑  收藏  举报