在IOS 7导航栏问题上呈现视图控制器

时间:2013-09-17 07:10:25

标签: uinavigationcontroller ios7 presentmodalviewcontroller

我已经下载了Xcode 5 GM种子并尝试在其上运行我的应用程序。

我为导航栏设置了一个黑色图像,可以在iOS 7上完美运行。

但是每当我呈现一个视图控制器时,导航条图像都没有正确设置。它正在显示补丁。

代码:

[self.navigationController.navigationBar setBackgroundColor:[UIColor blackColor]];
[self.navigationController.navigationBar setBarTintColor:[UIColor whiteColor]];

[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"top-nav-bar.png"] forBarMetrics:UIBarMetricsDefault];

enter image description here

有没有人遇到同样的问题?

编辑: 我有类似的问题,如下面的链接。 但在我的情况下,它只在呈现视图控制器时出现,并且在推送时效果很好。

  

navigation controller bar is being cut off

1 个答案:

答案 0 :(得分:1)

您需要了解以下内容:

tintColor 是条形按钮和标题颜色:

navigationBar.tintColor = [UIColor whitColor];

barTintColor 是条形背景颜色:

navigationBar.barTintColor = [UIColor colorWithRed:6.0/255.0 green:12.0/255.0 blue:19.0/255.0 alpha:1.0];

半透明,iOS7默认为YES

navigationBar.translucent = NO;

看一下Apple的下图:

enter image description here