Reputation: 145
I am making a slideshow for in my app. I want it almost like the photo app of Apple. It is almost finished just some small issues. I want to hide the navbar when tapped on the screen and show it when tapped again. But I am not sure how to do this.
Upvotes: 1
Views: 405
Reputation: 1
Make navigation translucent
self.navigationController.navigationBar.barStyle=UIBarStyleBlackTranslucent;
Upvotes: 0
Reputation: 2894
UITapGestureRecognizer *theSingleTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(handleSingleTapForImage:)]; [inImageView addGestureRecognizer:theSingleTapGesture]; [theSingleTapGesture release];
In gesture method show or hide NavigationBar
-(void)handleSingleTapForImage:(UITapGestureRecognizer *)sender {
[self.navigationController setNavigationBarHidden:![self.navigationController isNavigationBarHidden] animated:YES];
}
Upvotes: 0
Reputation: 63667
// catch the screen tap and call a method to hide the navigation bar
UITapGestureRecognizer *gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(toggleNavBar:)];
[self.view addGestureRecognizer:gesture];
[gesture release];
- (void)toggleNavBar:(UITapGestureRecognizer *)gesture {
BOOL barsHidden = self.navigationController.navigationBar.hidden;
[self.navigationController setNavigationBarHidden:!barsHidden animated:YES];
}
Upvotes: 2
Reputation: 89509
How do you want to hide the navigation bar? Tapping in the navigation bar (which would be quite tricky, if not downright impossible) or via some other button or via another method?
In general, you can definitely hide the navigation bar.
Look at [UINavigationController setNavigationBarHidden: animated:]
(I've linked the Apple documentation)
Upvotes: 1