Reputation: 759
I've got a view controller called CommentEditorViewController
presented modally and here is the code to dismiss it:
- (IBAction)doneButtonTouched:(id)sender
{
NSLog(@"doneButtonTouched");
[self dismissViewControllerAnimated:YES completion:^{
[[ImageStore sharedStore] setComment: self.textView.text forImageWithIndex:self.imageIndex];
}];
}
It works completely fine, but the problem is that the parent view controller's (which is called PhotosViewController
) viewWillAppear
and viewDidAppear
methods are being executed before this block. And I can't figure out, how to execute code right after this block completion. Should I do all this stuff in the block? If it is so, how should I do this?
Upvotes: 0
Views: 230
Reputation: 978
You have to move that code before the dismissViewControllerAnimated:completion: line , because the code written in completion block will execute when the viewcontroller is really eliminated , that just might be after viewDidAppear of parent viewcontroller.
Upvotes: 3