views:

665

answers:

2

I am trying to access the _tabBar instance from a UITabBarController. I am trying to hide the tabBar in certain situations, for this, I added an extension to UITabBarController, where I can access the _tabBar instance, and call the setHidden message. This works when compiling for the simulator, but when I compile for the device, I get the following error

"_OBJC_IVAR_$_UITabBarController._tabBar", referenced from: _OBJC_IVAR_$_UITabBarController._tabBar$non_lazy_ptr in UITabBarController+TabBar.o

What do I need to add to my compiler flags? and why does it works when compiling for the simulator.

Thanks in advance.

+3  A: 

According to The Docs for UITabBarController:

You should never attempt to manipulate the UITabBar object itself stored in this property. If you attempt to do so, the tab bar view throws an exception. To configure the items for your tab bar interface, you should instead assign one or more custom view controllers to the viewControllers property. The tab bar collects the needed tab bar items from the view controllers you specify.

The tab bar view provided by this property is only for situations where you want to display an action sheet using the showFromTabBar: method of the UIActionSheet class.

If you are pushing your UITAbBarController onto a navigation controller stack you can set the hidesBottomBarWhenPushed property to YES, and that will work.

There might also be another API in UITAbBarController's superclass that will do this. If not you could walk through the subview hierarchy and hide the necessary one.

Brad Smith
It was a totally different thing I was looking to do, nevertheless, the tabbar instance is accessible now in iPhone OS 3.0, it was added to the UITabBarController class.
Carlos Hernandez
A: 

It is accessible since iPhone OS 3.0

Carlos Hernandez