iOS Badge(Custom)

We can add badge some UIs, but some are not.

  • Top icon
  • UITabbar

These are allowed to add icon, but others are not. For example, I want to add badge to UIButton. That’s not prepared.

We need custom UI for it. iPhoneMK has a good solution for us.
iPhoneMK is big library. One of them, MKNumberBadgeView is that.

Sample App

This has sample app. Under the folder, you can find IPhoneMK Sample App.xcodeproj
NumberBadgeViewController is sample main source codes for badge.
You can see several style badge.
MKNumberBadgeView is badge view source code

iOS7 style

Unfortunately, this is iOS6 style, not iOS7 style

You need to change source code a bit.
MKNumberBadgeView.m

self.strokeWidth = 0.0;  // Remove stroke

shine, and shadow off.

MKNumberBadgeView badge = [MKNumberBadgeView alloc] initWithFrame:CGRectMake(0,0,10,10)];
badge.shine = NO;
badge.shadow = NO;

Result

Fancy! 🙂
badge