Calling viewwillappear after dismissing modalviewcontroller
presentModalViewController:animated:
/ dismissModalViewControllerAnimated:
are deprecated. Use presentViewController:animated:completion:
/ dismissViewControllerAnimated:completion:
instead.
You can use the completion block to execute any code post dismisal:
- (void) alertView: (UIAlertView *) alertView clickedButtonAtIndex: (NSInteger) buttonIndex{ if (buttonIndex == 0) { MyCustomViewController* mcvc = (MyCustomViewController*)self.presentingViewController; [self dismissViewControllerAnimated: YES completion: ^{ // call your completion method: [mcvc someCustomDoneMethod]; }]; }}
Better yet, if you're using a storyboard then you can implement an unwind segue and trigger your completion code in the unwind callback method.
Since you're presenting the modal view controller as a form sheet, the presenting controller's view never disappears, so viewWillAppear:
is not called after the dismissal. If you want the presenting view controller to handle something after the dismissal, call a delegate method in the modal controller's viewDidDisappear:
method. You've already set the delegate, so I presume you already have a delegate protocol in CreateActivity
.
By the way, you should use the non-deprecated methods to present and dismiss your modal view controller.