views:

160

answers:

1

How can I catch the event when an item is selected from a UITabBar on iPhone/iPad app?

+1  A: 

The UITabBar has a delegate property which you can use. Create a class that implements the UITabBarDelegate and the method:

– tabBar:didSelectItem: 

will do the trick

willcodejavaforfood
I have A view controller which inherits <UITABBarDelegate> in the .h file and in the .m file i have that method but it doesn't work. What I wwant ot do is to have in a ViewController a TabBar which has items dynamically loaded and whn the selected item has changed to change the content in a view control. I can't use UITabBarCOntroller because I want to create a multiplatform application.
dragos
The UITabBarController does not have to be the class that conforms to the UITabBarDelegate protocol. If it is not working I suggest you make sure you have actually set the delegate property in your code and/or in Interface Builder
willcodejavaforfood
added the following and it worked: tabBar.delegate=self;
dragos
Hey glad I could help, please accept my answer as the correct one :)
willcodejavaforfood