如何在特定日期设置闹钟并每周重复计划

问题描述:

UILocalNotification *localNotif = [[UILocalNotification alloc] init]; 
if (localNotif == nil) 
    return; 

localNotif.fireDate = selected; 
localNotif.timeZone = [NSTimeZone defaultTimeZone]; 
localNotif.repeatCalendar = [NSCalendar currentCalendar]; 

if (isSun) { 
    [components setWeekday:1]; 
    [localNotif setRepeatInterval:(NSInteger)components]; 
} 

if (isMon) { 
    [components setWeekday:2]; 
    [localNotif setRepeatInterval:(NSInteger)components]; 
} 

if (isTue) { 
    [components setWeekday:3]; 
    [localNotif setRepeatInterval:(NSInteger)components]; 
} 

if (isWed) { 
    [components setWeekday:4]; 
    [localNotif setRepeatInterval:NSWeekCalendarUnit]; 
} 

if (isThu) { 
    [components setWeekday:5]; 
    [localNotif setRepeatInterval:(NSInteger)components]; 
} 

if (isFri) { 
    [components setWeekday:6]; 
    [localNotif setRepeatInterval:(NSInteger)components]; 
} 

if (isSat) { 
    [components setWeekday:7]; 
    [localNotif setRepeatInterval:(NSInteger)components]; 
} 

我想在选定日期设置闹钟,并请更正我的代码,我是iphone新手。 帮助我。如何在特定日期设置闹钟并每周重复计划

+0

具有u与设置在特定days.i报警做,我也抽上它。但是我完全糊涂了。可ü帮助我怎么做。谢谢。 – Rani 2011-09-26 08:49:30

请参阅从苹果iOS开发者库此示例:

Scheduling, Registering, and Handling Notifications

+0

我如何重新安排每周重复。 – 2011-04-18 07:14:22

+0

@Rahul Salvikar:当警报准备好时你不打算通知用户吗?那么您将收到UILocalNotification meesage,并在下周的背景中重新设置闹钟。 – 2011-04-18 08:28:59

+0

谢谢我的问题解决了 – 2011-04-18 15:03:27