1.去掉UITabBarController背景色自带的蒙版
[tabbarController.tabBarsetBackgroundColor:[UIColorwhiteColor]];
[tabbarController.tabBarsetBackgroundImage:[UIImagenew]];
并且注意
[UITabBar appearance].barStyle = UIBarStyleDefault;
可以看看Black的效果
2.设置UITabBarController上UITabbarItem的字体颜色及选中态颜色
NSMutableDictionary *attr3=[NSMutableDictionary dictionary];
attr3[NSForegroundColorAttributeName]=[UIColor blackColor];
attr3[NSFontAttributeName]=[UIFontsystemFontOfSize:CTabbarFontSize];
[[UITabBarItem appearance]setTitleTextAttributes:attr3 forState:UIControlStateNormal];
NSMutableDictionary *attr4=[NSMutableDictionary dictionary];
attr4[NSForegroundColorAttributeName]=[UIColor redColor];
attr4[NSFontAttributeName]=[UIFontsystemFontOfSize:CTabbarFontSize];
[[UITabBarItem appearance]setTitleTextAttributes:attr4 forState:UIControlStateSelected];
3.关于UITabbar一开始颜色正确,进入页面再出来后颜色错误的问题,是因为退出后按钮显示的是你设置的setTintColorColor
所以要增加tintcolor与上面的arrt4一致。
[tabbarController.tabBarsetTintColor:[UIColor redColor]];
网友评论