1、iOS15 适配导航栏
之前的导航栏设置方法失效了,具体原因可以参考 详情参考官网,现在需要通过 UINavigationBarAppearance 方式进行设置:
、、、
if (@available(iOS 15.0, *) ) {
UINavigationBarAppearance * appearance = [[UINavigationBarAppearance alloc] init];
[appearance configureWithTransparentBackground];// 去除横线
appearance.backgroundColor = APP_BLACK_2C2E44_COLOR;// 导航栏背景色
appearance.titleTextAttributes = @{NSForegroundColorAttributeName:UIColor.whiteColor};// 导航栏标题颜色
[UINavigationBar appearance].standardAppearance = appearance;
[UINavigationBar appearance].scrollEdgeAppearance = appearance;
[[UINavigationBar appearance] setScrollEdgeAppearance:appearance];
[[UINavigationBar appearance] setStandardAppearance:appearance];
}
、、、
2、iOS15 适配Tabbar
现在需要通过 UITabBarAppearance 方式进行设置:
if (@available(iOS 15.0, *)) {
UITabBarAppearance * appearance = [[UITabBarAppearance alloc] init];
appearance.backgroundColor = UIColor.whiteColor;
appearance.stackedLayoutAppearance.normal.titleTextAttributes = @{NSForegroundColorAttributeName:APP_GRAY_333333_COLOR};// tabbar未选中字体颜色
appearance.stackedLayoutAppearance.selected.titleTextAttributes = @{NSForegroundColorAttributeName:APP_GRAY_333333_COLOR};// tabbar选中字体颜色
appearance.stackedLayoutAppearance.normal.iconColor = APP_GRAY_333333_COLOR;// tabbar未选中图片颜色
[UITabBar appearance].scrollEdgeAppearance = appearance;
[UITabBar appearance].standardAppearance = appearance;
}
、、、
如有不对,请帮忙指正
网友评论