系統(tǒng)自動默認(rèn)渲染
本來的tabBarItem.image的是黑色的
然而運行時的顏色就變成系統(tǒng)默認(rèn)的藍(lán)色
下面就是取消渲染的方法
tabBarItem.image取消渲染
把要取消默認(rèn)渲染的標(biāo)簽image進(jìn)行以下操作
tabBarItem.title取消渲染
在_TabBarController.m文件中寫下以下代碼
NSMutableDictionary * attrs = [NSMutableDictionary dictionary];
attrs[NSFontAttributeName] = [UIFont systemFontOfSize:12];
attrs[NSForegroundColorAttributeName] = [UIColor grayColor];
NSMutableDictionary * dataAttrs = [NSMutableDictionary dictionary];
dataAttrs[NSFontAttributeName] = [UIFont systemFontOfSize:12];
dataAttrs[NSForegroundColorAttributeName] = [UIColor grayColor];
UITabBarItem * item = [UITabBarItem appearance];
[item setTitleTextAttributes:attrs forState:UIControlStateNormal];
[item setTitleTextAttributes:dataAttrs forState:UIControlStateSelected];
因為只要有UI_APPEARANCE_SELECTOR就可以進(jìn)行統(tǒng)一設(shè)置所以上面代碼只要設(shè)置一次雨涛,不需要在標(biāo)簽控制器的每個子視圖都去設(shè)置一次了桂对。