开发者

how to set the badgevalue in tabbar in iphone?

开发者 https://www.devze.com 2022-12-21 22:45 出处:网络
I am using the following code to set the badgevalue in current tab bar but its not visible in tab bar

I am using the following code to set the badgevalue in current tab bar but its not visible in tab bar

开发者_如何学Go
self.navigationController.tabBarItem.badgeValue = @"1"

what is the correct way of putting the badge value in the tab bar.


This is how I access the badgeValue on a tabBarItem:

UITabBarItem * tabBarItem = (UITabBarItem *)[aTabBarController.tabBar.items objectAtIndex:1];
tabBarItem.badgeValue = @"1";


Did you figure out why this self.navigationController.tabBarItem.badgeValue = @"1" didn't work? I got the same problem but didn't know why.
But this way it works:

[[[[self tabBarController] tabBar] items] objectAtIndex:0] setBadgeValue:@"AB"];
0

精彩评论

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