I want to put the notification in the tab bar of the app to show the number of item selected for the shopping list. Is there any way to add the notification in the tab bar of app.
You mean the badge? Do something like (where self
is a UIViewController
):
[[self tabBarItem] setBadgeValue:@"42"];
On the storyboard you have to select your navigation view controller if you have and then open your Property window and set Badge according to your requirement.
if you want to set programmatically
1. find your tabbar Item by viewcontroller
# badge=what you want to set.
2.[[[[self tabBarController] tabBar] items] objectAtIndex:1] setBadgeValue:badge];
and if you want to set by storyboard please refer this image.
Hope this will helps. Thanks
Also if you want to use in swift. Below code will work for you
[[self tabBarItem] setBadgeValue:@"42"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With