Reputation: 95
I used the following code to display a calendar using EVENTKIT
- (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;
}
When i call this above function , an eventkit view controller is displayed. When i click the the alert button in that, i will get the default alert timing as like below
I want the event alert timing in whatever way i wish like 1 day before,2 days before upto 30 days before.
Can anyone please tell me how to do this Many Thanks in advance
Upvotes: 4
Views: 484
Reputation: 26177
You'll want to create an EKAlarm, and add that alarm to your event. For instance, for an alarm that occurs 15 min before:
EKAlarm *alarm = [EKAlarm alarmWithRelativeOffset:-900]; // 15 min alarm
[event addAlarm:alarm];
Upvotes: 3