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.
Asked
Active
Viewed 5,641 times
3

max_
- 24,076
- 39
- 122
- 211
4 Answers
3
Consider subclassing UITabBarItem and drawing it yourself

Tom van der Woerdt
- 29,532
- 7
- 72
- 105
-
10UITabBarItem doesn't even inherit from UIView. Can you please clarify your suggestion? – Raphael Oliveira Aug 18 '15 at 18:34
0
Sascha Paulus wrote a great class that does just this:
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
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