Tabbar hide badge when Tabbaritem touched
-
16-09-2019 - |
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
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