I know that it's trivial to add a red number badge to an app's icon on the home screen. What's the best way to get a badge that looks like this within my app? There are some classes I've found online that can do this, such as MKNumberBadgeView, but none that I've found look completely right. Facebook, for example, implements red badges within the app perfectly as far as I can see. Did they just build their own badges by trial and error? Any suggestions would be appreciated.
Thanks,
Luke
Where do you want the badge? The standard badge can trivially be added to a UITabBarItem
through the badgeValue
property. It is documented here.
I am using this by Sascha Paulus - http://www.spaulus.com/2011/04/custombadge-2-0-retina-ready-scalable-light-reflex/?lang=en
Which is a class that you can drop into your project, easy enough to customize for the appearance you are looking for. I had a slight issue with the placement of the number within the red badge so I shifted it slightly. Other than that, all good.
This one looks 100% like the Apple one and it's also completely customizable: https://github.com/JaviSoto/JSBadgeView
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With