1、iOS15 適配導(dǎo)航欄
之前的導(dǎo)航欄設(shè)置方法失效了,具體原因可以參考 詳情參考官網(wǎng),現(xiàn)在需要通過 UINavigationBarAppearance 方式進(jìn)行設(shè)置:
、、、
if (@available(iOS 15.0, *) ) {
UINavigationBarAppearance * appearance = [[UINavigationBarAppearance alloc] init];
[appearance configureWithTransparentBackground];// 去除橫線
appearance.backgroundColor = APP_BLACK_2C2E44_COLOR;// 導(dǎo)航欄背景色
appearance.titleTextAttributes = @{NSForegroundColorAttributeName:UIColor.whiteColor};// 導(dǎo)航欄標(biāo)題顏色
[UINavigationBar appearance].standardAppearance = appearance;
[UINavigationBar appearance].scrollEdgeAppearance = appearance;
[[UINavigationBar appearance] setScrollEdgeAppearance:appearance];
[[UINavigationBar appearance] setStandardAppearance:appearance];
}
、、、
2、iOS15 適配Tabbar
現(xiàn)在需要通過 UITabBarAppearance 方式進(jìn)行設(shè)置:
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;
}
、、、
如有不對(duì),請(qǐng)幫忙指正