我用下面的代碼創建一個事件,顯示彈出要求用戶保存事件報警的日曆事件:創建使用EKEventEditViewController
EKEventStore *eventStore = [[EKEventStore alloc] init];
EKCalendar *calendar = [eventStore defaultCalendarForNewEvents];
EKEvent *event = [EKEvent eventWithEventStore:eventStore];
event.calendar = calendar;
event.title = [NSString stringWithFormat:@"Event: %@", [self.event title]];
event.location = self.event.location;
event.notes = [self stringByStrippingHTML: [self.event description]];
event.startDate = [self.event startDate];
event.endDate = [self.event endDate];
NSTimeInterval alarmOffset = -1*60*60;//1 hour
EKAlarm *alarm = [EKAlarm alarmWithRelativeOffset:alarmOffset];
[event addAlarm:alarm];
EKEventEditViewController *eventViewController = [[EKEventEditViewController alloc] init];
eventViewController.event = event;
eventViewController.eventStore=eventStore;
eventViewController.editViewDelegate = self;
[self.navigationController presentModalViewController:eventViewController animated:YES];
這工作得很好,除了事件報警財產不被設置,你可以看到形成下面的圖片:
如果我展示它得到報警設置視圖控制器之前保存的事件。
請注意我正在使用LLVM編譯器,所以不要擔心沒有發佈的東西!
鉭
羅斯
後,你有沒有解決這個問題後,上面的代碼?我不認爲這是可能的。我認爲最好的解決辦法是創建自己的editEventController – Herman