Method for when the modal view has been dismissed
iphone, model-view-controller
Solution
UIViewController has a property called `parentViewController`. In the case that a view controller is presented modally, the `parentViewController` property points to the view controller that presented the modal view controller.
In your modal view controller, in `viewWillDisappear:` you can send a message to the `parentViewController` to perform any action you wish, essentially.
Something like:
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[self.parentViewController doSomething];
}
If your parent view controller is a table view controller, then you should be able to call `[self.parentViewController.tableView reloadData];` to do what you're trying to achieve.
Problem
I have created an application with a modal view that I can display and then dismiss. Is there an easy way to know when the modal view has been dismissed? I would like to reload the data in a table once the modal view has been dismissed and don't know the best way of doing this. Thanks