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
2010-07-26 13:31:03
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
2010-07-26 13:37:26
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
2010-07-26 13:39:58
added the following and it worked: tabBar.delegate=self;
dragos
2010-07-27 14:00:26
Hey glad I could help, please accept my answer as the correct one :)
willcodejavaforfood
2010-07-27 14:14:38