1

How can I customise the badge number on UITabBarItem?

Something like this

enter image description here

Chinthaka
  • 966
  • 1
  • 13
  • 42

1 Answers1

6

Have a Look at MKNumberBadgeView. Its a little Class for your Custom BadgeView.

Using it like this I am able to add it to my custom UITabBarController:

    MKNumberBadgeView *badge = [[MKNumberBadgeView alloc] initWithFrame:CGRectMake(110, self.view.frame.size.height-20, 30, 30)];
    badge.value = 12;
    UIWindow *window = [[UIApplication sharedApplication].windows objectAtIndex:0];
    [[[window subviews] objectAtIndex:0] addSubview:badge];

Wich will look like this:

enter image description here

Of course you have to take care of rotating issues when adding the badgeView to the window. But I guess you can customize MKNumberBadgeView to make it look the way you want it, give it a try.

pmk
  • 1,897
  • 2
  • 21
  • 34