当我从表格视图中删除单元格时,我想从日历中删除事件我添加了这样的事件
eventStore = [[EKEventStore alloc] init];
EKEvent *myEvent = [EKEvent eventWithEventStore:eventStore];
myEvent.title = [alertBodyField text];
myEvent.startDate = [theDatePicker date];
NSLog(@"%@",myEvent.startDate);
myEvent.endDate = [theDatePicker date];
myEvent.allDay=NO;
[myEvent setCalendar:[eventStore defaultCalendarForNewEvents]];
NSError *err;
[eventStore saveEvent:myEvent span:EKSpanThisEvent error:&err];
if (err == noErr) {
}
但我如何删除事件
答案 0 :(得分:1)
只需为EKEventStore调用removeEvent:span:error:方法。
[eventStore removeEvent:myEvent span:EKSpanThisEvent error:&err];