0

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?

Let's Bi
  • 269
  • 1
  • 2
  • 12
  • Consider getting in the habit of familiarizing yourself with the iOS documentation. It is a fun read sometimes and can really help you out quickly. – Carl Veazey Sep 29 '12 at 04:15

1 Answers1

1

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];
digidigo
  • 2,534
  • 20
  • 26