更新了iOS 15(XCode 13)后,导航栏和Tabbar莫名其妙的改变了,导航栏变成了黑色、Tabbar变成了透明。由于框架是上一个人写的,所以具体的原因也不得知。一顿百度后解决了问题。
具体方法如下:
1.导航栏问题
if(@available(iOS13.0, *)) {
UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
[appearanceconfigureWithOpaqueBackground];
appearance.backgroundColor = UIColor.whiteColor;
self.navigationController.navigationBar.standardAppearance = appearance;
self.navigationController.navigationBar.scrollEdgeAppearance = self.navigationController.navigationBar.standardAppearance;
}
2.Tabbar问题
if(@available(iOS15.0, *)) {
UITabBarAppearance * appearance = [UITabBarAppearance new];
UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
self.tabBar.scrollEdgeAppearance= appearance;
}