Nik*_*Kov 1 uitabbarcontroller uitabbaritem uitabbar tvos tvos13
TvOS 13. 我有一个带有选项卡的 UITabBarController。并且可以自定义几乎所有东西,除了这个明显的东西:聚焦标签的背景。它总是白色的。
指南告诉
为选定和未选定的项目指定色调
我试过:
view.backgroundColor = .purple
tabBar.tintColor = .yellow
tabBar.barTintColor = .red
tabBar.unselectedItemTintColor = .brown
tabBar.backgroundColor = .green
tabBar.backgroundImage = UIColor.blue.toImage()
tabBar.shadowImage = UIColor.orange.toImage()
tabBar.selectionIndicatorImage = UIColor.burgundy.toImage()
Run Code Online (Sandbox Code Playgroud)
没有任何帮助。
在对 UITabBar 和 UITabBarController 的各种属性进行了一番尝试之后,我终于弄明白了。
要改变属性关注项目的背景颜色是selectionIndicatorTintColor的UITabBarAppearance(文件)。
由于它在 tvOS >= 13.0 上可用,因此您必须像这样包装作业:
if #available(tvOS 13.0, *) {
tabBar.standardAppearance.selectionIndicatorTintColor = .white
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
815 次 |
| 最近记录: |