I want to add setBadgeValue in my tab bar in Objective-C

0 votes
asked Feb 17, 2010 by uttam

This is my code that I am using for this but I am getting the only the tab bar, not the badgeValue on the second item of the tab bar.

    tabBarController = [[UITabBarController alloc] init];
navigationController = [[UINavigationController alloc] init];
navigation1Controller = [[UINavigationController alloc] init];
navigation2Controller = [[UINavigationController alloc] init];
navigation3Controller = [[UINavigationController alloc] init];
navigation4Controller = [[UINavigationController alloc] init];
//navigation5Controller = [[UINavigationController alloc] init];

Recipe *photos = [[Recipe alloc] init];
shopping *videos = [[shopping alloc] init];
Interact *quiz = [[Interact alloc] init];
Video *aboutus = [[Video alloc] init];
about *feedback = [[about alloc] init];
int indexICareAbout = 2;
NSString *badgeValue = @"10";

[[[[[self tabBarController] tabBar] items] 
  objectAtIndex:indexICareAbout] setBadgeValue:badgeValue];  


     [navigationController pushViewController:photos animated:NO]; 
     [navigation1Controller pushViewController:videos animated:NO]; 
     [navigation2Controller pushViewController:quiz animated:NO]; 
     [navigation3Controller pushViewController:aboutus animated:NO]; 
     [navigation4Controller pushViewController:feedback animated:NO]; 


  tabBarController.viewControllers = [NSArray   arrayWithObjects:navigationController,navigation1Controller,navigation2Controller,navigatio  n3Controller,navigation4Controller,nil];  

 tabBarController.moreNavigationController.navigationBar.barStyle =       UIBarStyleBlackOpaque;

tabBarController.customizableViewControllers = nil;
[self.view addSubview:tabBarController.view];

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...