标签:
IOS8.0以前直接显示:
UIApplication *application=[UIApplication sharedApplication]; //设置图标上的更新数字 application.applicationIconBadgeNumber=3;
IOS8.0以后需加上以下代码让用户选择是否显示
float versionNumber=[[[UIDevice currentDevice] systemVersion] floatValue]; if (versionNumber >= 8.0) {//通知设置 UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge categories:nil]; //接收用户的选择 [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; }
类似下面效果:
标签:
原文地址:http://www.cnblogs.com/yayozen/p/4277652.html