On the iPhone, how can I make the icon badge?

2019-04-09 18:40发布

问题:

I want to set an icon badge while I am not in the application, like the Mail application. How can I do that?

回答1:

From within your application you can use the applicationIconBadgeNumber property of UIApplication to set the badge number:

[UIApplication sharedApplication].applicationIconBadgeNumber = 1;

If you want to change the badge without the user launching your app, you need to use the push notification service. The Push Notification Service Programming Guide should have all the info you need.



回答2:

The iPhone SDK doesn't support that functionality yet. It can only be done on a jailbroken device.

EDIT: Sorry that's not ENTIRELY true, you can do it with the 'push' function but only apps that are screened by Apple are allowed at this stage.

EDIT AGAIN: Nope I'm completely wrong try this

[UIApplication sharedApplication].applicationIconBadgeNumber = 2;


标签: iphone icons