// Tabbar
// Icon inactive
[[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor darkGrayColor]} forState:UIControlStateNormal];
// Icon active
[[UITabBar appearance] setTintColor:PRIMARY_COLOR];
// Text active
[[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: PRIMARY_COLOR} forState:UIControlStateSelected];
// Background
[[UITabBar appearance] setBarTintColor:WHITE_COLOR];
// Over View YES/NO
[[UITabBar appearance] setTranslucent:NO];
我在文字和图标周围有一个灰色的矩形。
为什么?我该死的错误在哪里?
最佳答案
经过讨论,我们发现@CeccoCQ为UIView
使用了另一个设置。这使得每个视图都具有自定义的背景颜色(在图像中为灰色)。
[[UIView appearance] setBackgroundColor:WINDOW_BACKGROUND_COLOR];
要解决此问题,请删除此自定义设置,然后一切正常。