我有一个UITabBarController
的子类和自定义项。自定义如下:
private func updateTabBar() {
guard let items = tabBar.items,
tabViewControllers.count == items.count else {
return
}
for (item, vc) in zip(items, tabViewControllers) {
// setting items title, image, selectedImage ...
item.setTitleTextAttributes(Self.normalAttributes, for: .normal)
item.badgeColor = .customColor
}
}
这在iOS 14及之前版本中运行良好,但在iOS 15上不行。我找到了一些关于
scrollEdgeAppearance
的信息。这可以防止黑色背景。但设置有颜色的文本属性和徽章颜色会被忽略。
问题是如何在UITabBarItem
上设置自定义文本颜色和徽章颜色?