Add Badge for Notifications to Button

Discussion in 'iOS Programming' started by RagingGoat, Mar 20, 2013.

  1. RagingGoat macrumors 6502

    Joined:
    Jun 21, 2010
    #1
    The home screen of my app has several buttons. I'm wondering if there is a way to add a badge for push notifications to one of those buttons.
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    There's no built-in way to draw a badge. The only built-in badge support that I know of is to add a badge to your app's icon on the springboard (maybe something also for tabs in a tab controller). There's a certain amount of source code floating around to do that so look for it.
     
  3. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #3
    It would be pretty easy to create a custom subclass of UIButton that has the option to display a badge. Then the view controller that manages the button could set the button's badge value as needed.
     

Share This Page