Let's Bi
Let's Bi

Reputation: 269

Badge on TabBarItem

I use UITabBarController for iOS app. it has 3 tabs. For example tab1 (current tab), tab2 and tab3. I want put a small red badge on tab3 icon when click a button on tab1. Is there any way to add it?

Upvotes: 0

Views: 474

Answers (1)

digidigo
digidigo

Reputation: 2584

UITabBarItems have a badgeValue property. You can set this when your delegate method gets fired.

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item; 

You can get the TabBarItem #3 from the tabBarController with

[tabBarController.tabBar.items objectAtIndex:2];

Upvotes: 1

Related Questions