Reputation: 399
how to make tab bar icon clickable. Once I tap on it should get a pop-up or an alert (UIAlertView
).
I know how to present UIAlertView
, but i want to have alert on click the tab bar icon.
Upvotes: 0
Views: 380
Reputation: 3364
First you need to set your UITabBarController
to its delegate and use the method didSelectItem
In .h
add <UITabBarDelegate>
In viewDidLoad
yourTabBarController.delegate=self;
Then use the delegate method:
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
{
if(item == yourAlertTab)
{
//Code to show alert.
}
}
Upvotes: 2