使用点按手势隐藏和显示导航栏

时间:2012-06-20 21:31:41

标签: iphone view navigation gesture

  

可能重复:
  Hide/Show Navigation & Tool Bar on tap

这是我用来在其中一个视图中隐藏导航栏的空白。

- (void)viewWillAppear:(BOOL)animated {
    [self.navigationController setNavigationBarHidden:YES];

    [super viewWillAppear:animated];
}

如何点按屏幕隐藏并显示导航栏?

1 个答案:

答案 0 :(得分:3)

你想要那样的东西吗?

- (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];
}