我想为 iOS 6 和 7 开发应用程序。
基本上我从 Xocde 5 开始,包括 Storyboard
和 ARC
在我的项目中。
现在,我想改变 NavigationBar
的颜色来自 Storyboard
但 Storyboard仅显示 BarTintColor
属性(仅适用于 iOS 7
)和 Storyboard
未显示 TintColor
NavigationBar
的属性(property)(在 iOS 6
中改变颜色)。
我应该如何改变 NavigationBar
的颜色在 iOS 6
使用相同 Storyboard
?
我也面临同样的问题 UITabBar
仅显示 BarTintColor
属性(property)而不是 TintColor
iOS 6
的属性(property)
提前致谢。
最佳答案
将此代码添加到您的 appDelegate
#import "yourMainViewController"
yourMainViewController = [[yourMainViewController alloc] initWithNibName:@"yourMainViewController" bundle:nil];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:self.yourMainViewController];
NSArray *ver = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
if ([[ver objectAtIndex:0] intValue] >= 7) {
navController.navigationBar.barTintColor = [UIColor yourColore];
navController.navigationBar.translucent = NO;
}else {
navController.navigationBar.tintColor = [UIColor yourColore];
}
self.window.rootViewController = navController;
关于iphone - Xcode 5 UINavigationBar TintColor 属性未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19266647/