Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Self-Destructing Message iPhone App Designing and Starting the App A Storyboard with a Tab Bar Controller

badgeValue

Tabs have a property named badgeValue that displays text in a red circle in the upper-right corner of the tab, like the number badges on the Mail or Messages apps. Set the badge value to '3' for the tab variable you just set. Note: badgeValue must be an NSString!

I know that I have to declare badgeValue as an NSString, but after that I'm stuck...If someone could point me in the right direction id appreciate it.

2 Answers

Gareth Borcherds
Gareth Borcherds
9,372 Points

badgeValue is simply a property of the UITabBarItem you just created. All you need to add is:

tab.badgeValue = @"3";

Which access the badgeValue property of the UITabBarItem.

Wow, that makes sense. Thanks!

  [[[[[self tabBarController] tabBar] items]
    objectAtIndex:1] setBadgeValue:@"3"];