To add Badge to UITabBarItem in UIViewController, first let us declare the UITabBarItem 'firstTab' and assign the required TabBarItem by using ObjectAtIndex.
Then, set the badge value using the property badgeValue in UITabBarItem object.
Then, set the badge value using the property badgeValue in UITabBarItem object.
UITabBarItem *firstTab = [self.tabBar.items objectAtIndex:0];firstTab.badgeValue = @"5";