Objective c IOS 6导航控制器导航栏

Objective c IOS 6导航控制器导航栏,objective-c,uinavigationbar,ios6,addsubview,Objective C,Uinavigationbar,Ios6,Addsubview,我刚刚将手机更新为IOS 6,但在UINavigationController导航栏上添加UIImageView时遇到了一些问题。这是我的密码 UIImage *logoImage = [UIImage imageNamed:@"navigationbar.png"]; UIImageView *logoImageView = [[UIImageView alloc] initWithImage:logoImage]; UINavigationBar *navBar = self.navigat

我刚刚将手机更新为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


有什么建议吗?

我想你不需要IOS 6中的
UIImageView

您只需在
UINavigationBar
(例如在
AppDelegate
)中放置背景图像,如下所示:

[[UINavigationBar appearance] setBackgroundImage :[UIImage imageNamed:@"navigationbar"]];
找到了一个很好的网站,解释了IOS 6中一些新的用户界面定制:


我认为在IOS 6中不需要
UIImageView

您只需在
UINavigationBar
(例如在
AppDelegate
)中放置背景图像,如下所示:

[[UINavigationBar appearance] setBackgroundImage :[UIImage imageNamed:@"navigationbar"]];
找到了一个很好的网站,解释了IOS 6中一些新的用户界面定制:


添加:
。。。forBarMetrics:UIBarMetricsDefault
添加:
。。。forBarMetrics:UIBarMetricsDefault