本地通知计时器重置

时间:2014-03-15 23:49:54

标签: ios objective-c localnotification

我有定时器重置问题。如何让计时器开始计时通知,这意味着在按下最后一个按钮之前有200秒的延迟?

- (IBAction)buttonPressed:(id)sender {
    UILocalNotification *localNotification = [[UILocalNotification alloc] init];
    localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:200];
    localNotification.soundName = UILocalNotificationDefaultSoundName;
    localNotification.alertBody = @" More Quiz ";
    localNotification.timeZone = [NSTimeZone defaultTimeZone];

    [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
}

1 个答案:

答案 0 :(得分:1)

你不是。只需致电cancelLocalNotification:并安排一个新的。