我升级到XCode 4.2。当我的应用程序在iOS 4.0模拟器中运行时,导航栏显示在多个视图中,并被推入。当应用程序在iOS 5.0模拟器中运行并且在装有iOS 5.0的设备上运行时,导航栏在所有视图中都消失了,并且表格视图被上推以填充该空间。导航控制器使用以下代码创建的:导航控制器栏后退按钮在iOS 5中缺失
navigationController = [[UINavigationController alloc] initWithRootViewController:swViewController];
和意见被压入navigationController像这样:
[window addSubview:self.navigationController.view];
:
UIBarButtonItem *backButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"NextLevel" style:UIBarButtonItemStylePlain target:nil action:nil] autorelease] ;
self.navigationItem.backBarButtonItem = backButtonItem;
[self.navigationController pushViewController:self.listController animated:YES];
的navigationController经由添加到窗口
更新1 - 它看起来像iOS 5中的导航栏默认是隐藏的,所以我加了
[[self navigationController] setNavigationBarHidden:NO animated:YES];
我现在看到了导航栏,但没有backButtonItem中指定的后退按钮。
更新2 - 我也设置了navigationController标题,但是也没有显示出来。
self.navigationController.title = @"Title";
是否有东西丢失或需要使用导航栏是在安装iOS 5.0的顶部可见?
它很可能是因为它在iOS 5上破解的原因是我以前做错了什么。每次升级Apple都会尝试改进错误检查。我在上面添加了你的代码,但是没有修复它。 –