美文网首页iOS15IOS开发
xcode 13 iOS 15的坑:解决tabbar变透明了

xcode 13 iOS 15的坑:解决tabbar变透明了

作者: 一支烟一只猿 | 来源:发表于2021-09-23 15:31 被阅读0次

xcode更新13版本后 旧工程编译完发现tabbar变透明了

如图变成透明背景色了

iOS15 系统tabbar下会出现透明,解决方法如下:

在baseTabbarViewControl viewDidLoad中调整如下:

 if (@available(iOS 15.0, *)) {
        UITabBarAppearance * appearance = [UITabBarAppearance new];
        UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
        appearance.backgroundImage = [UIImage jk_captureWithView:effectView];//把毛玻璃View转成Image
        self.tabBar.scrollEdgeAppearance = appearance;
    }

改完后恢复之前的形状

UITabBar新增新的属性名为scrollEdgeAppearance

/// Describes the appearance attributes for the tabBar to use when an observable scroll view is scrolled to the bottom. If not set, standardAppearance will be used instead.
@property (nonatomic, readwrite, copy, nullable) UITabBarAppearance *scrollEdgeAppearance UI_APPEARANCE_SELECTOR API_AVAILABLE(ios(15.0));

完事

相关文章

网友评论

    本文标题:xcode 13 iOS 15的坑:解决tabbar变透明了

    本文链接:https://www.haomeiwen.com/subject/belogltx.html