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;
self.tabBar.standardAppearance = appearance;
}
UITabBar新增新的属性名为scrollEdgeAppearance/standardAppearance
/// 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));
@property (nonatomic, readwrite, copy) UITabBarAppearance *standardAppearance UI_APPEARANCE_SELECTOR API_AVAILABLE(ios(13.0), tvos(13.0));