Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tabbar hide badge when Tabbaritem touched

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

like image 390
Ptitaw Avatar asked Dec 29 '22 19:12

Ptitaw


1 Answers

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;
}
like image 122
Will Harris Avatar answered Jan 13 '23 06:01

Will Harris