Bathi Babu Bathi Babu - 1 year ago 134
iOS Question

How to add badge for bar button?

I am new for iOS mobile developing.I want to add badge for UIbarbuttonitem.I am added UIbarbuttonitem in UI side.Can you please help me any one.Thanks in advance.

Answer Source

Download class from here UIBarButtonItem-Badge and import in your project only UIBarButtonItem+Badge.h or UIBarButtonItem+Badge.m class in project and import in your class

#import "UIBarButtonItem+Badge.h"

write down only one line for set badge

self.navigationItem.rightBarButtonItem.badgeValue = @"5"; //your value 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download