Possible Duplicate:
Hide/Show Navigation & Tool Bar on tap
这是我用来隐藏其中一个 View 中的导航栏的空白。
- (void)viewWillAppear:(BOOL)animated {
[self.navigationController setNavigationBarHidden:YES];
[super viewWillAppear:animated];
}
如何点击屏幕隐藏和显示导航栏?
最佳答案
你想要这样的东西吗?
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationController.navigationBar.translucent = YES;
self.wantsFullScreenLayout = YES;
UITapGestureRecognizer *tap = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideShowNavigation)] autorelease];
tap.numberOfTapsRequired = 1;
[self.view addGestureRecognizer:tap];
}
- (void) hideShowNavigation
{
[self.navigationController setNavigationBarHidden:!self.navigationController.navigationBarHidden];
}
关于iphone - 通过点击手势隐藏和显示导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11128536/