如何为特定日期制作活动?

时间:2012-07-10 04:44:03

标签: iphone

应该存储事件详细信息?如何为我不知道的特定事件发出警报。请帮助代码或提供该类型示例的链接。 提前谢谢。

2 个答案:

答案 0 :(得分:2)

您可以使用本地通知,这里有一些用于安排的示例代码。

- (void)scheduleNotification {

    UILocalNotification *notif = [[UILocalNotification alloc] init];

    //notification for 3 days
    notif.fireDate = [NSDate dateWithTimeInterval:60.0f*60.0f*24.0f*3.0f sinceDate:[NSDate date]];
    notif.timeZone = [NSTimeZone defaultTimeZone];
    notif.alertBody = @"We've missed you!";
    notif.alertAction = @"PLAY";
    notif.soundName = UILocalNotificationDefaultSoundName;
    notif.applicationIconBadgeNumber = 1;
    [[UIApplication sharedApplication] scheduleLocalNotification:notif];

}

答案 1 :(得分:1)

您可以在iPhone中以未来日期的方式为iPhone中的活动安排提醒。这是一个示例项目,它将帮助您以程序方式在iPhone中安排活动。检查此链接。 https://developer.apple.com/library/ios/#samplecode/SimpleEKDemo/Introduction/Intro.html