1
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 が初めてです。助けて。

4

1 に答える 1

2

Apple iOS Developer Library の次のサンプルを参照してください。

通知のスケジューリング、登録、および処理

于 2011-04-17T11:36:43.943 に答える