ChenYilong / CYLTabBarController

[EN]It is an iOS UI module library for adding animation to iOS tabbar items and icons with Lottie, and adding a bigger center UITabBar Item. [CN]【中国特色 TabBar】一行代码实现 Lottie 动画TabBar,支持中间带+号的TabBar样式,自带红点角标,支持动态刷新。【iOS13 & Dark Mode & iPhone XS MAX supported】
MIT License
6.9k stars 1.45k forks source link

[bug]: iOS适配问题 #573

Closed ghost closed 2 years ago

ghost commented 2 years ago

iOS15 设置 backgroundImage 无效

weweco123 commented 2 years ago

遇到类似的问题,TabBar的背景变成透明。使用的版本是 1.29.2 。 1、在 iOS 15 系统,我的App TabBar上面有4个controller,在这4个controller 上面点击切换controller,TabBar的背景有的会自动变成透明,有的不会。 2、在iOS 14系统以下,不会出现任何问题。

如何解决?

ghost commented 2 years ago

亲测可行:


if #available(iOS 15.0, *) {

            let appearance = UITabBarAppearance()
            appearance.backgroundImageContentMode = .scaleToFill
            appearance.backgroundImage = img
            tarBarVC.tabBar.scrollEdgeAppearance = appearance
            tarBarVC.tabBar.standardAppearance = appearance

}else {
            tarBarVC.tabBar.backgroundImage = img
}
weweco123 commented 2 years ago

Nice,非常感谢,节日快乐。