The easiest way is UITabBarDelegate. I'm sorry. Add your class and inherit the protocol by adding <UITabBarDelegate> after defining your class, for example:
@interface MyViewController : UIViewController<UITabBarDelegate>
and then define the tabBar:didSelectItem: method in this class, for example.
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
Then set the delegate in your tab as follows: myTabBar.delegate = myClassInstance . The tabBar:didSelectItem: method can be anywhere, including your view controller, and here you get the event the button was clicked on. More details here:
http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UITabBarDelegate_Protocol/Reference/Reference.html
source share