if (@available(iOS 13.0, *)) {
UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
appearance.shadowImage = [UIImage imageWithColor:KWhiteColor];
[appearance configureWithOpaqueBackground];
appearance.backgroundColor = KWhiteColor;
nav.navigationBar.standardAppearance = appearance;
nav.navigationBar.scrollEdgeAppearance = appearance;
[nav.navigationBar setShadowImage:nil];
[nav.navigationBar setShadowImage:[UIImage imageWithColor:KWhiteColor]];
[nav.navigationBar setBackgroundImage: [UIImage imageWithColor:KWhiteColor] forBarMetrics:UIBarMetricsDefault];
} else {
// Fallback on earlier versions
}
//全局设置
if (@available(iOS 13.0, *)) {
UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init];
[appearance configureWithOpaqueBackground];
appearance.backgroundColor = kWhiteColor;
[[UINavigationBar appearance] setStandardAppearance:appearance];
[[UINavigationBar appearance] setScrollEdgeAppearance:appearance];
} else {
// Fallback on earlier versions
[[UINavigationBar appearance] setBarTintColor:kWhiteColor];
[[UINavigationBar appearance] setTranslucent:NO];
}
发表回复