Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to customize UITabBarItem Badge?

The question below is similar as mine.

How to use a custom UIImage as an UITabBarItem Badge?

Is it possible to use a background image instead of drawing it myself? I think it's fine since my app will only use a 1-digit badgeValue.

If it is not really possible, I want to know if we can change the badge color instead. The answers in the question below are not really helping.

Is it possible to change UITabBarItem badge color

like image 346
Michelle Ybanez Avatar asked Apr 29 '13 08:04

Michelle Ybanez


1 Answers

You can use a more robust solution @UITabbarItem-CustomBadge.

Demo

enter image description here

Simple two line of code can get you going

- (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;
}
like image 95
Ratul Sharker Avatar answered Sep 21 '22 12:09

Ratul Sharker