3

How can I add a custom UIImage as the Badge for a UITabBarItem?
I.e It will show up when the badge value of the UITabbarItem is set.

max_
  • 24,076
  • 39
  • 122
  • 211

4 Answers4

3

Consider subclassing UITabBarItem and drawing it yourself

Tom van der Woerdt
  • 29,532
  • 7
  • 72
  • 105
0

Sascha Paulus wrote a great class that does just this:

CustomBadge2.0

You can of course use it in combination with subclassing UITabBarItem.

Rok Jarc
  • 18,765
  • 9
  • 69
  • 124
0

u can use the following custom class for CustomBadge:

https://github.com/ckteebe/CustomBadge/tree/master/Classes

i hope this will help you.

hpp
  • 619
  • 3
  • 13
0

Can have a look inside here. Here custom item is added as a UILabel. Consider using your own choices here.

Demo

enter image description here

and only two line of code, to get you go

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  //supplying the animation parameter
  [UITabBarItem setDefaultAnimationProvider:[[DefaultTabbarBadgeAnimation alloc] init]];
  [UITabBarItem setDefaultConfigurationProvider:[[DefaultSystemLikeBadgeConfiguration alloc] init]];

  //rest of your code goes following...

  return YES;
}
Community
  • 1
  • 1
Ratul Sharker
  • 7,484
  • 4
  • 35
  • 44