如何修复iOS 15标签栏滚动到底部后透明的问题:
在 iOS 15 中,UIKit 扩展了scrollEdgeAppearance 的使用,默认情况下会生成透明背景。
由于我在 iOS 15 之前在应用程序中全局更改了标签栏颜色,因此我已将以下代码添加到我的 AppDelegate 中:
UITabBar.appearance().barTintColor = "YOUR UITABBAR COLOR"
UITabBar.appearance().tintColor = "YOUR ICONS COLOR"
UITabBar.appearance().isTranslucent = true
为了恢复旧的外观,我采用了新的 UITBar 外观 API,UITabBarAppearance。我将代码更改为:
UITabBar.appearance().barTintColor = "YOUR UITABBAR COLOR"
UITabBar.appearance().tintColor = "YOUR ICONS COLOR"
UITabBar.appearance().isTranslucent = true
if #available(iOS 15.0, *) {
let appearance = UITabBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = "YOUR UITABBAR COLOR"
UITabBar.appearance().standardAppearance = appearance
UITabBar.appearance().scrollEdgeAppearance = UITabBar.appearance().standardAppearance
}
As a result, I get the original color of my UITabBar
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)