I have an iPhone app that is based on a navigation controller.
I have a main view controller that displays a list of articles, and a detail view, where you can see one article in a UIWebView
. For the detail view, I have the navigation bar on the top, and a UIToolbar
on the bottom.
I'd like to auto-hide them with a slide animation (to top and bottom) and restore them when tapping the screen. I thought this would be a standard function, but couldn't find how to do it.
As a reference, this is what Stanza or the NYT app do.
Set up a method that runs this on a tap event:
if (![navigationController isNavigationBarHidden])
[navigationController setNavigationBarHidden:YES animated:YES]; // hides
else
[navigationController setNavigationBarHidden:NO animated:YES]; // shows
As for the UIToolbar
, it is a UIView
subclass, so you should be able to pretty easily set up a custom animation for sliding this in and out of sight.
There is also quite a useful method for UIVIewController.
- (BOOL) hidesBottomBarWhenPushed {
//hide a toolbar or whatever
return NO;
}
Try this:
BOOL hide = ![self.navigationController isNavigationBarHidden];
[self.navigationController setNavigationBarHidden:hide animated:YES];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With