如何通过单击TabbarItem按钮获取Tabbar项目按钮的Click事件?

如何通过单击TabbarItem按钮获取Tabbar项目按钮的Click事件?

问题描述:

我已经使用了UITabbar,我使用了两个按钮作为TabItem。我想通过点击那两个按钮来执行两个不同的动作,那么如何在点击特定的Tabbar按钮时获得特定的动作。

I have taken UITabbar on that i have used two buttons as TabItem.I want to perform two different Action by clicking on that two button so how can i get particular Action on clicking on particular Tabbar button.

您最有可能想利用UITabBarControllerDelegate,然后处理didSelectViewController方法。

You most likely want to take advantage of the UITabBarControllerDelegate, and then handle the didSelectViewController method.

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController

有关详细信息,请参阅此处: http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITabBarControllerDelegate_Protocol/Reference/Reference.html

See here for more details: http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITabBarControllerDelegate_Protocol/Reference/Reference.html