[英]Xcode 5 UINavigationBar TintColor property not showing
我想為iOS 6和7開發應用程序。
基本上,我的項目是從Xocde 5(包括Storyboard
和ARC
開始的。
現在,我想從Storyboard
更改NavigationBar
顏色,但Storyboard僅顯示BarTintColor
屬性(僅適用於iOS 7
), Storyboard
不顯示NavigationBar
TintColor
屬性(更改iOS 6
顏色)。
如何使用相同的Storyboard
在iOS 6
更改NavigationBar
顏色?
我也面臨UITabBar
相同問題,僅顯示BarTintColor
屬性而不顯示iOS 6
TintColor
屬性
提前致謝。
將此代碼添加到您的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;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.