1. setBarTintColor 设置颜色在导航中会变色,怎么让他不变颜色,一句代码就可以改变,加上上面[[UINavigationBar appearance] setTranslucent:NO]代码即可;
2.[[UINavigationBar appearance] setTranslucent:NO]这句话是控制导航栏颜色是否透明。
3.复制代码如下:
if (IOS7) {
[[UINavigationBar appearance] setBarTintColor:[ZGCoreUtil colorWithHexString:@"#c3401d" alpha:1.0]];
[[UINavigationBar appearance] setTranslucent:NO];
}
else {
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
}
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
4.[ZGCoreUtil colorWithHexString:@"#c3401d" alpha:1.0] 这是个颜色方法,自己去设置下就好。
本文介绍如何使用一行代码解决iOS应用中导航栏颜色变化的问题,并提供了兼容iOS 7及以上的代码示例。

192

被折叠的 条评论
为什么被折叠?



