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
UIViewController has a property called
parentViewController. In the case that a view controller is presented modally, theparentViewControllerproperty points to the view controller that presented the modal view controller.In your modal view controller, in
viewWillDisappear:you can send a message to theparentViewControllerto perform any action you wish, essentially.Something like:
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.