Question

I trying to use tabbar badges but i have problem ... I have found how to set the badge

but i can't find how to catch the touch event for the tabbaritem so i can delete the badge when the user is on the corresponding tabbaritem

Thanks for your help

Was it helpful?

Solution

You need to implement tabBarController:didSelectViewController: on the tab bar's delegate. To clear the badge, set it to nil. For example:

- (void) tabBarController:(UITabBarController*)aTabBarController
  didSelectViewController:(UIViewController*)viewController
{
    viewController.tabBarItem.badgeValue = nil;
}

OTHER TIPS

Note: Write down inside Viewcontroller of Tabbar on which you have displayed badge.

-(void) viewWillAppear:(BOOL)animated{

// reseting tabbar badge value...
self.tabBarItem.badgeValue = nil;

}

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top