在iPhone上,我该如何制作图标徽章?

时间:2022-01-25 04:36:18

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

我想在我不在应用程序中时设置图标徽章,例如Mail应用程序。我怎样才能做到这一点?

2 个解决方案

#1


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

在您的应用程序中,您可以使用UIApplication的applicationIconBadgeNumber属性来设置徽章编号:

[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.

iPhone SDK尚不支持该功能。它只能在越狱设备上完成。

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.

编辑:对不起,这不是真的,你可以使用'推送'功能,但只允许在这个阶段由Apple筛选的应用程序。

EDIT AGAIN: Nope I'm completely wrong try this

再次编辑:不,我完全错了试试这个

[UIApplication sharedApplication].applicationIconBadgeNumber = 2;

#1


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

在您的应用程序中,您可以使用UIApplication的applicationIconBadgeNumber属性来设置徽章编号:

[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.

iPhone SDK尚不支持该功能。它只能在越狱设备上完成。

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.

编辑:对不起,这不是真的,你可以使用'推送'功能,但只允许在这个阶段由Apple筛选的应用程序。

EDIT AGAIN: Nope I'm completely wrong try this

再次编辑:不,我完全错了试试这个

[UIApplication sharedApplication].applicationIconBadgeNumber = 2;