Knodel
Knodel

Reputation: 4389

How to hide an iPhone Tab Bar?

I have a small multiview app. It consists of a UITabBarController with a nav controller in each tab. What I want is to show a UIImageView when a user shakes the device. After I've implemented the loading of the UIImageView, I faced a problem-the image was only 2/3 of the screen because of the tab and nav bars. I managed to hide the nav bar but I'm still stuck with the tab bar. I tried many solutions such as [tabBar setHidden: YES]; but I get errors "tabBar undeclared", although I've imported the AppDelegate, where the tabBar was defined.

Thanks in advance!

Upvotes: 3

Views: 3846

Answers (2)

Eric Schweichler
Eric Schweichler

Reputation: 1092

Try setting

myViewController.hidesBottomBarWhenPushed = YES;

when you create your UIImageView. When you push it on to the view stack the UITabBar will hide automatically, and it will be restored automatically when you pop or dismiss the controller. No need for the application delegate.

Upvotes: 5

pheelicks
pheelicks

Reputation: 7469

If you want to show a full screen view, it is best to use a modal view controller. This way you do have to worry about hiding/showing navigation items. Take a look at:

http://developer.apple.com/iphone/library/featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html

to get started.

Upvotes: 0

Related Questions