我有一个全屏模态视图,如下所示:
PreferencesController *nextWindow = [[[PreferencesController alloc] initWithNibName:@"Preferences" bundle:nil] autorelease];
UINavigationController* navController = [[[UINavigationController alloc] initWithRootViewController:nextWindow] autorelease];
[self presentModalViewController:navController animated:YES];
然后从这个 modalView 中我推送另一个 View :
MyController *nextWindow = [[[MyController alloc] initWithNibName:@"tmp" bundle:nil] autorelease];
[self.navigationController pushViewController:nextWindow animated:YES];
在这个新 Controller 中,我有这个 viewDidLoad :
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"Borders";
self.navigationController.navigationBarHidden = NO;
}
leftBarButtonItem 未处于事件状态,我的意思是触摸它不会突出显示它,也不会返回到上一个 View 。
我的 View 全屏显示,并在应用程序初始化时调用 [[UIApplication shareApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
。
导航栏框架为 0,0,320,44。
navigationBar super View 框架是0,0,320,480。
viewController View 框架为 0,0,320,436。
我尝试调用 viewDidLoad self.navigationController.navigationBar.userInteractionEnabled = YES;
和 self.navigationItem.leftBarButtonItem.enabled = YES;
但没有效果。
会发生什么?
编辑:
我的 self.navigationController.navigationItem.backBarButtonItem 为 NIL。
self.navigationController.navigationItem 不是 NIL
最佳答案
每当我遇到这种 react 迟钝的情况时,总是因为框架问题。即 NavigationController 的 super View 小于 NavigationController 的 View 。我知道您说所有内容都设置为全屏,但我会通过为层次结构中的每个 View 打开“clipsSubviews”来验证所有内容实际上都是全屏。
关于iPhone - 导航栏后退按钮项目没有响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5362877/