我可以通过编程方式从iOS 5通知中心清除我的应用程序通知吗? [英] Can I programmatically clear my app's notifications from the iOS 5 Notification Center?
本文介绍了我可以通过编程方式从iOS 5通知中心清除我的应用程序通知吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想删除我的应用从iOS 5通知中心发出的旧通知。我可以这样做吗?如果是这样,怎么做?
I would like to remove old notifications that my app has made from the iOS 5 Notification Center. Can I do this? If so, how?
推荐答案
要从通知中心删除通知,只需将图标徽章编号设置为零。
To remove notifications from the Notification Center simply set your icon badge number to zero.
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
这仅在号码更改时有效,因此如果您的应用不使用徽章编号,则首先设置,然后重置它。
This only works if the number changes, so if your app doesn't use the badge number you have to first set, then reset it.
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:1];
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
这篇关于我可以通过编程方式从iOS 5通知中心清除我的应用程序通知吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文