ios - 为什么我的标签栏呈现为灰色矩形?

标签 ios objective-c xcode

enter image description here

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

文本和图标周围有一个灰色矩形。 为什么?我该死的错误在哪里?

enter image description here

最佳答案

经过讨论,我们发现@CeccoCQ 对UIView 使用了另一种设置。这使得每个 View 都有自定义背景颜色(在图像中,它是灰色)。

[[UIView appearance] setBackgroundColor:WINDOW_BACKGROUND_COLOR];

要解决此问题,请删除此自定义设置,一切都会正常进行。

关于ios - 为什么我的标签栏呈现为灰色矩形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47514091/

相关文章:

iOS 横向 View 在键盘显示时移动文本字段

ios - Xcode 自动将信息图标/"Accessory Button"添加到我的表格单元格

android - React Native - 设置 TextInput 光标位置

ios - 一些 NSCoding 变量未被检索

objective-c - 空 NSIndexSet 传递给 NSArray objectAtIndexes,返回 nil 或空 NSArray?

ios - 找不到 PDF 标题 : `%PDF' not found

iphone - 如何在 iPhone App 中通过蓝牙以二进制形式传输数据

xcode - 无效的虚拟文件系统覆盖文件

ios - React Native 移除 IOS 中的默认启动器或闪屏

iphone - 如何存储所有这些预先创建的数据?