Ios 是否可以使用eventkit更改icalendar中的默认报警计时?
我使用以下代码使用EVENTKIT显示日历Ios 是否可以使用eventkit更改icalendar中的默认报警计时?,ios,objective-c,eventkit,Ios,Objective C,Eventkit,我使用以下代码使用EVENTKIT显示日历 - (BOOL)createEvent:(NSString *)title at:(NSString *)location starting:(NSDate *)startDate ending:(NSDate *)endDate withBody:(NSString *)body { eventStore = [[EK
- (BOOL)createEvent:(NSString *)title
at:(NSString *)location
starting:(NSDate *)startDate
ending:(NSDate *)endDate
withBody:(NSString *)body
{
eventStore = [[EKEventStore alloc] init];
EKEvent *event = [EKEvent eventWithEventStore:eventStore];
event.title = title;
event.location = location;
event.startDate = startDate;
event.endDate = endDate;
event.notes = body;
[event setCalendar:[eventStore defaultCalendarForNewEvents]];
EKEventEditViewController *eventViewController = [[EKEventEditViewController alloc] init];
eventViewController.event = event;
eventViewController.eventStore = eventStore;
//eventViewController.editViewDelegate = self;
[self presentModalViewController:eventViewController animated:YES];
return TRUE;
}
当我调用上述函数时,将显示一个eventkit视图控制器。
当我点击其中的警报按钮时,我将获得如下所示的默认警报时间
我希望事件警报以我希望的任何方式计时,比如1天前、2天前到30天前
谁能告诉我怎么做
非常感谢您提前创建EKAlarm,并将其添加到您的事件中。例如,对于15分钟前发生的报警:
EKAlarm *alarm = [EKAlarm alarmWithRelativeOffset:-900]; // 15 min alarm
[event addAlarm:alarm];
尝试: