3

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!

DShah
  • 9,768
  • 11
  • 71
  • 127
Knodel
  • 4,359
  • 8
  • 42
  • 66

2 Answers2

5

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.

Eric Schweichler
  • 1,092
  • 6
  • 11
  • Thank you very much! It helped! But when the tab bar is hiding, it's animated. Is it possible to disable the animation? – Knodel Mar 23 '10 at 13:21
  • I don't think so, or at least I don't see anything in the documentation - http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006926-CH3-SW11 – Eric Schweichler Mar 23 '10 at 14:12
0

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.

pheelicks
  • 7,461
  • 2
  • 45
  • 50