xcode 13 iOS 15的坑:解决tabbar变透明了
2021-09-23 本文已影响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));