目前我在导航控制器中使用 QLPreviewController。(推视图控制器)
为了隐藏导航栏,我使用了 UITapGestureRecognizer。用户可以通过单击(点击)显示/隐藏导航栏。这在 iOS5 中运行良好
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped:)];
[tapRecognizer setNumberOfTapsRequired:1];
[tapRecognizer setDelegate:self];
[[self view] addGestureRecognizer:tapRecognizer];
[tapRecognizer release];
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES;
}
- (void)tapped:(UIGestureRecognizer*)gestureRecognizer
{
//hide -/- show navigation bar
[[self navigationController] setNavigationBarHidden:![[[self navigationController] navigationBar] isHidden] animated:YES];
}
但是在 iOS 6 的发布版本中,现在完全忽略了点击,所以我不能再隐藏我的导航栏了。
为什么我要隐藏导航栏?
如果您打开 .numbers 文档,导航栏会隐藏导航栏下方的“工作表按钮”。
泰。