iOS7 navigationBar和TabBar Color表现得很奇怪

use*_*064 5 iphone objective-c ios ios7

这就是我要的.它加载到我的一些视图控制器上.

大家好,

我疯狂地试图使我所有viewControllers的色调都一样.有些人看起来比其他人暗得多.我想要的只是整个浅色......

这就是我要的

有时我会得到这种丑陋的深灰色......我不确定我做错了什么.我检查了.m文件,并没有设置色调或任何东西......不确定为什么它在每个viewController上都不一致...

这就是我得到的

任何帮助都会很棒.谢谢!

Nit*_*hel 17

在iOS7导航栏中是默认的,translucent=YES所以只需改为NO,如下: -

self.navigationController.navigationBar.translucent=NO;
Run Code Online (Sandbox Code Playgroud)

并设置Navigaitonbar颜色或其他属性自定义如Bellow将此代码放入Appdelegate类didFinishLaunchingWithOptionsappearance用于全球应用: -

if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {

    // Load resources for iOS 6.1 or earlier
     [[UINavigationBar appearance]setTintColor:NavigationColor];
} else {
     [[UINavigationBar appearance]setTintColor:[UIColor whiteColor]]; // it set color of bar button item text
     [[UINavigationBar appearance]setBarTintColor:[UIColor GreenColor]]; // it set color of navigation
     [[UINavigationBar appearance] setBarStyle:UIBarStyleDefault]; // it set Style of UINavigationBar
     [[UINavigationBar appearance]setTitleTextAttributes:@{UITextAttributeTextColor : [UIColor whiteColor]}]; //It set title color of Navigation Bar
    // Load resources for iOS 7 or later

}
Run Code Online (Sandbox Code Playgroud)

对于tabBar也是如此,默认情况下translucent=YES更改为NO

[self.tabBarController.tabBar setTranslucent:NO];
Run Code Online (Sandbox Code Playgroud)