0
- (void)eventEditViewController:(EKEventEditViewController *)controller 
        didCompleteWithAction:(EKEventEditViewAction)action {

    NSError *error = nil;
    EKEvent *thisEvent = controller.event;

    switch (action) {
        case EKEventEditViewActionCanceled:
            // Edit action canceled, do nothing. 
            break;

        case EKEventEditViewActionSaved:
            // When user hit "Done" button, save the newly created event to the event store, 
            // and reload table view.
            // If the new event is being added to the default calendar, then update its 
            // eventsList.
            if (self.defaultCalendar ==  thisEvent.calendar) {
                [self.eventsList addObject:thisEvent];
            }
            [controller.eventStore saveEvent:controller.event span:EKSpanFutureEvents error:&error];
            [self.tableView reloadData];
            break;

        case EKEventEditViewActionDeleted:
            // When deleting an event, remove the event from the event store, 
            // and reload table view.
            // If deleting an event from the currenly default calendar, then update its 
            // eventsList.
            if (self.defaultCalendar ==  thisEvent.calendar) {
                [self.eventsList removeObject:thisEvent];
            }
            [controller.eventStore removeEvent:thisEvent span:EKSpanFutureEvents error:&error];
            [self.tableView reloadData];
            break;

        default:
            break;
    }
    // Dismiss the modal view controller
    [controller dismissModalViewControllerAnimated:YES];

}

のこの関数 EKEventEditViewDelegate。「アクション」値がどのボタンをクリックしたときに知りたいですEKEventEditViewActionDeletedここに画像の説明を入力

最初は、イベントの削除ボタンをクリックすると、action == EKEventEditViewActionDeleted. だがしかし。誰でも私を助けることができますか?

4

1 に答える 1

0

EKEventViewDelegate プロトコルを実装し、削除イベントを確認します...

-(void) eventViewController:(EKEventViewController *)controller didCompleteWithAction:(EKEventViewAction)action
{
    if (action == EKEventViewActionDeleted) {
        // Update unique event ID to core data & change text of button to new
        _itemReminder = NULL;
        _part.reminderID = NULL;
        _savedEventFound = NO;
        [_reminderButton  setTitle: @"New" forState: UIControlStateNormal];

    }
}
于 2013-12-07T13:33:37.280 に答える