2012-08-16 66 views
4

我用下面的代碼中使用EVENTKIT是否可以使用eventkit更改icalendar中的默認鬧鐘時間?

- (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視圖控制器。 當我點擊了警報按鈕,我會得到默認警報定時,像下面

Event Alert

我要盡我希望像前1天,前2天高達事件警報時間30天前。

誰能告訴我如何做到這一點 許多在此先感謝

+0

嘗試:http://stackoverflow.com/a/13347525/1442541 – evya 2013-04-04 12:57:16

回答

3

你想創建一個EKAlarm,並添加警報您的活動。例如,對於發生在15分鐘前的警報:

EKAlarm *alarm = [EKAlarm alarmWithRelativeOffset:-900]; // 15 min alarm 
    [event addAlarm:alarm]; 
相關問題