IOS 6 navigationController导航栏

时间:2012-09-27 00:47:07

标签: objective-c uinavigationbar ios6 addsubview

我刚刚将手机更新为IOS 6,但我在UINavigationController导航栏上添加UIImageView时遇到了一些问题。这是我的代码

UIImage *logoImage = [UIImage imageNamed:@"navigationbar.png"];
UIImageView *logoImageView = [[UIImageView alloc] initWithImage:logoImage];
UINavigationBar *navBar = self.navigationController.navigationBar;
[navBar addSubview:logoImageView];
[logoImageView release];

这将在导航栏上添加徽标,它在IOS 6的较低版本上运行良好。但在IOS 6上显示的徽标,但后退按钮位于徽标后面,因此不显示后退按钮。

我不想覆盖UINavigationBar drawrect,因为我在弹出的代码上也有UINavigatioBar。

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

我认为您在IOS 6中不需要UIImageView

您可以将背景图片放在UINavigationBar中(例如在AppDelegate中),如下所示:

[[UINavigationBar appearance] setBackgroundImage :[UIImage imageNamed:@"navigationbar"]];

找到一个很好的网站,解释了IOS 6中的一些新的用户界面定制:

click here