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

 

转载于:https://www.cnblogs.com/DannyApple/p/3971926.html

你可能感兴趣的:(【IOS】修改TabBar属性)