iphone - 通过点击手势隐藏和显示导航栏

标签 iphone view navigation gesture

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/

相关文章:

iphone - UIWebView 无法识别 TapGesture(根本不会调用方法)

iphone - 获取 UIPinchGestureRecognizer 手指位置

ios - (Swift)外部 View 中定义的 UICollectionView 中的 didSelectItemAtIndexPath 不起作用

iphone - 从 iOS 中的 iPhone 相机库将图像发布到 Facebook

html - 使用 Bootstrap 将 Logo 与 ASP.NET MVC 4 上的输入字段对齐

php - Magento - 在后端打印发票时空白/空白页

model-view-controller - "numerical rounding"在 View 中还是在模型中?

html - css 仅水平子导航

navigation - angular2 中的重新导航()

editor - 触摸打字员如何在 vi 中导航?