每天消防UILocalNotification,但每天在特定时间
问题描述:
我想消防UILocalNotification
的长达8天,但每天我都想在不同的特定时间解雇他们。因此,如:1
日:火通知在11:00至12:00
日2:12:00火通知和14:00
第3天:火通知在13:00至16:00
第4天:在14:00火通知和18:00
第5天:在16:00
第6天火通知:火通知18:00
第7天:火通知在8 18:00
天:在18:00的火灾通知
(时间只是例子)每天消防UILocalNotification,但每天在特定时间
我已经在做repeatInterval
的事情了,但这可能不是问题;
NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar] ;
NSDate *now = [NSDate date];
NSDateComponents *components = [calendar components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute) fromDate:now];
[components setHour:22];
[components setMinute:15];
UILocalNotification *notification1 = [[UILocalNotification alloc]init];
notification1.fireDate = [calendar dateFromComponents:components];
notification1.repeatInterval = NSDayCalendarUnit;
[notification1 setAlertBody:@"Test notification"];
[[UIApplication sharedApplication] scheduleLocalNotification:notification1];
答
不,你不能。 -repeatInterval
属性可用于同时在特定单位(日,周...)重复通知。此外,您无法为每个应用设置超过64个notif。
你可以做的是以不同的时间设置你的通知,以一周为单位 repeatInterval
。
你从我们这里除了什么?码?我们为什么要给你免费的代码?如果你有问题,我们会帮助你,但不是这样。 [问] – idmean 2014-09-06 20:24:24