iphone - Xcode 5 UINavigationBar TintColor 属性未显示

标签 iphone ios objective-c xcode storyboard

我想为 iOS 6 和 7 开发应用程序。

基本上我从 Xocde 5 开始,包括 StoryboardARC在我的项目中。

现在,我想改变 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/

相关文章:

ios - MKMapView 忽略 iOS 11 和 iPhone X 上的安全区域

iphone - 为什么我在编辑图像时会得到这些奇怪的结果?

ios - 在 Xcode 5.1 中配置 PhoneGap 3.5 会破坏插件

iphone - iOS - 获取窗口中 View 的位置?

iphone - 在设备上安装配置文件没有任何作用 xcode 6

ios - 在 xib、界面生成器中创建 UIView,而不使用 UIViewController 将其附加到窗口

iOS 和谷歌云消息 : Missing push notifications in series of notifications

ios - 弹出 View 不显示 subview

ios - UIAlertViewController : Separate tint colors for cancel and other action buttons

ios - 如何随机化数组中的单元格内容