Setting badge value in UITabBarItem in UIViewController

Biranchi picture Biranchi · Jan 31, 2011 · Viewed 15.3k times · Source

I am adding UITabBarController to the window, and setting the viewControllers property of the UITabBarController to the array of ViewControllers. If i am setting the badge value inside the viewController then its working fine. self.tabBarItem.badgeValue = @"3";

But if i am setting the viewControllers property of the UITabBarController to the array of navigation controllers which is having view controller as the rootviewcontroller, then its not setting the badge value.

Any suggestions ??

Thanks

Answer

Biranchi picture Biranchi · Feb 1, 2011

Yes, i got the answer.

[[self navigationController] tabBarItem].badgeValue = @"3";