开发者

Remove Badge from tabbar item

开发者 https://www.devze.com 2022-12-23 17:09 出处:网络
How to Remove Badge from the tabbar item i had use below code but not working for me. UITabBarItem开发者_JAVA百科 *chatbadge=[appDelegate.tabBarController.tabBar.items objectAtIndex:2];

How to Remove Badge from the tabbar item i had use below code but not working for me.

UITabBarItem开发者_JAVA百科 *chatbadge=[appDelegate.tabBarController.tabBar.items objectAtIndex:2];
chatbadge.badgeValue=nil;

Suggest any Solution.


Try doing it via the viewController:

UIViewController *viewController = [appDelegate.tabBarController.viewControllers objectAtIndex:2];

viewController.tabBarItem.badgeValue = nil;


Swift version & this is really weird

self.tabBarController?.viewControllers?[3].tabBarItem.badgeValue = nil

is working and not

self.tabBarItem.badgeValue = nil
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号