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 trialRyan Conroy
2,305 PointsbadgeValue
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
9,372 PointsbadgeValue 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.
Camilo Castro
Courses Plus Student 2,549 Points [[[[[self tabBarController] tabBar] items]
objectAtIndex:1] setBadgeValue:@"3"];
Ryan Conroy
2,305 PointsRyan Conroy
2,305 PointsWow, that makes sense. Thanks!