If a modal view is presented from a framework (in my case eventkit), What would be the correct way to detect if the cancel or if the done button is pressed. In my example on the didCompleteWithaction my modal view is dismissed, an alert view is fired. I want the alert view only fired if the Done button is pressed rather than the cancel button.
My initial thoughts were an if statement when the the done button is pressed, however im not sure how I get the property of the done button.
- (void)eventEditViewController:(EKEventEditViewController *)controller
didCompleteWithAction:(EKEventEditViewAction)action {
// Dismiss the modal view controller
[controller dismissModalViewControllerAnimated:YES];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"message" message:@"Added to calender" delegate:nil cancelButtonTitle: @"Ok" otherButtonTitles: nil];
[alert show];
}
Look at the delegate’s protocol reference: apple documentation
You will have to check the
actionparameter of the delegate method, as it represents what action the user chose.Eg
I don’t know what action will be triggered by the “done” button, possibly …ActionSaved – but check it out yourself.