How can I use iOS's standard red number badges within my app?

Luke picture Luke · Oct 10, 2010 · Viewed 22.4k times · Source

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

Answer

Sedate Alien picture Sedate Alien · Oct 10, 2010

Where do you want the badge? The standard badge can trivially be added to a UITabBarItem through the badgeValue property. It is documented here.