簡體   English   中英

Xcode 5 UINavigationBar TintColor屬性未顯示

[英]Xcode 5 UINavigationBar TintColor property not showing

我想為iOS 6和7開發應用程序。

基本上,我的項目是從Xocde 5(包括StoryboardARC開始的。

現在,我想從Storyboard更改NavigationBar顏色,但Storyboard僅顯示BarTintColor屬性(僅適用於iOS 7 ), Storyboard不顯示NavigationBar TintColor屬性(更改iOS 6顏色)。

如何使用相同的StoryboardiOS 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM