Nsstring *alarmID = @"some_ID_to_cancel"; UIlocalnotification *notificationToCancel=nil; for(UIlocalnotification *aNotif in [[UIApplication sharedApplication] scheduledlocalnotifications]) { if([aNotif.userInfo objectForKey:@"ID"] isEqualToString:alarmID]) { notificationToCancel = aNotif; break; } } [[UIApplication sharedApplication] cancellocalnotification:notificationToCancel];
为了更好地使用它,你可以通过
UIlocalnotification *localNotif = [[UIlocalnotification alloc] init]; if (localNotif == nil) return; localNotif.fireDate = itemDate; localNotif.timeZone = [NSTimeZone defaultTimeZone]; localNotif.alertAction = NSLocalizedString(@"VIEw Details",nil); localNotif.alertbody = Title; localNotif.soundname = UIlocalnotificationDefaultSoundname; NSDictionary *infoDict = [NSDictionary dictionaryWithObject:stringID forKey:@"ID"]; localNotif.userInfo = infoDict; [[UIApplication sharedApplication] schedulelocalnotification:localNotif]; [localNotif release];总结
以上是内存溢出为你收集整理的打开和关闭警报ios全部内容,希望文章能够帮你解决打开和关闭警报ios所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)