// 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
使用了另一种设置。这使得每个 View 都有自定义背景颜色(在图像中,它是灰色)。
[[UIView appearance] setBackgroundColor:WINDOW_BACKGROUND_COLOR];
要解决此问题,请删除此自定义设置,一切都会正常进行。
关于ios - 为什么我的标签栏呈现为灰色矩形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47514091/