首先,您需要将您设置UITabBarController
为它的委托并使用该方法didSelectItem
在.h
添加<UITabBarDelegate>
在viewDidLoad
yourTabBarController.delegate=self;
然后使用委托方法:
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
{
if(item == yourAlertTab)
{
//Code to show alert.
}
}