Reputation:
I'm trying to hide my navigationBar and toolbars on tap, similar to the way the Photos application works.
Any pointers would be greatly appreciated.
Thanks!
Upvotes: 10
Views: 6238
Reputation: 51
In iOS 8, you can simply achieve by this:
self.navigationController.hidesBarsOnTap = YES
Upvotes: 2
Reputation: 175
well you can still use the
[self.navigationController setNavigationBarHidden:YES animated:YES];
and you can stop your view from sliding up when the navigation/ toolbar shows. You can have your navigation/tool bar fade in and out over the view without sliding the view. Try this code it did work for me.
self.wantsFullScreenLayout = YES;
that is if you are currently on the view controller.
Upvotes: 0
Reputation: 977
This works too :)
[self.navigationController setNavigationBarHidden:YES animated:YES];
Upvotes: 11
Reputation: 101
Try to animate the y value of UINavigationBar and UIToolBar like this
[UIView beginAnimations: nil context:NULL];
[UIView setAnimationDuration:0.4];
[UIView setAnimationDelegate: self];
CGRect rect = self.navigationController.navigationBar.frame;
rect.origin.y = -40;
self.navigationController.navigationBar.frame = rect;
[UIView commitAnimations];
Hope this helps you too.
A.
Upvotes: 9