Bathi Babu Bathi Babu - 2 months ago 14
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

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 
Comments