Reputation: 101
In our app we are displaying Notifications in alert style. Displaying notification is working fine and we also get callback when user interacts with the notification either by clicking on notification or by clicking on Action button. But the Alert Notification Pop up stay on the screen instead of going away even after user has dismissed it by clicking on the content of the notification.It goes away only after clicking close button.Pop up stay on the screen where as notification get cleared from notification center.
Is there is any solution to dismiss pop up when user click the content of alert notification.
Upvotes: 2
Views: 352
Reputation: 21891
You'll need to handle this manually. Implement the delegate method -userNotificationCenter:didActivateNotification:
like this:
- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification
{
if (notification.activationType == NSUserNotificationActivationTypeContentsClicked) {
[center removeDeliveredNotification:notification];
}
}
Upvotes: 2