Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add notifications to icon in iOS application

Tags:

ios

iphone

I see that some applications in iPhone show a red circle with the number of notifications from the application, how is that done?

like image 607
José Avatar asked Jul 22 '11 23:07

José


People also ask

How do I get notifications to show up on icons?

Turn on App icon badges from Settings. Navigate back to the main Settings screen, tap Notifications, and then tap Advanced settings. Tap the switch next to App icon badges to turn them on.

How do I add notifications to iOS apps?

Go to Settings > Notifications and select an app. Tap Show Previews and choose an option.

Can Apple Shortcuts show notifications?

The Show Notification action creates a system notification. Show Notification runs instantly and continues to the next action (unlike the Show Alert action, which pauses the shortcut).

How do I add push notifications to an app?

Turn on notifications for Android devicesTap More on the bottom navigation bar and select Settings. Tap Turn on notifications. Tap Notifications. Tap Show notifications.


2 Answers

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:99]

Zero value hides the badge.

like image 81
Anton Avatar answered Oct 10 '22 03:10

Anton


It is called a Badge, and it is used for icons, tabbaritems mostly.

You can set it up like

UITabBarItem *featured = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemFeatured tag:0]; 
featured.badgeValue = @"1";
like image 25
Legolas Avatar answered Oct 10 '22 01:10

Legolas