Kirity
Kirity

Reputation: 283

How to clear notification after reading it from IOS notification center one by one?

In IOS app, is there any options to clear a single notification or marked it as read after tapping on it? My belief is that Apple does not provide this feature. They only provide to clear all the notifications at a time. I searched a lot but didn't find any solution. Though I have found clearing one notification at a time in some apps (ex. Gmail).

Thanks in advance!

Upvotes: 1

Views: 2608

Answers (2)

Scott Berrevoets
Scott Berrevoets

Reputation: 16946

I don't know how this would work with push notifications, but you can cancel individual local notifications like this:

[[UIApplication sharedApplication] cancelLocalNotification:notification];

You can get a reference to the notification that was tapped by the App Delegate application:DidReceiveLocalNotification method.

Upvotes: 1

Omar Abdelhafith
Omar Abdelhafith

Reputation: 21221

You can set the number in this property

 [UIApplication sharedApplication].applicationIconBadgeNumber

For example to decrease it by one

[UIApplication sharedApplication].applicationIconBadgeNumber -= 1;

To set it to a specific value

[UIApplication sharedApplication].applicationIconBadgeNumber = 5;

Upvotes: 1

Related Questions