Reputation: 23
After a modal view controller is dismissed, is there any delegate method called to bring the parent view controller to the front?
Upvotes: 0
Views: 3685
Reputation: 23
I ended up using delegation from Apple's View Controller Programming Guide for iOS :
When it comes time to dismiss a modal view controller, the preferred approach is to let the parent view controller do the dismissing. In other words, the same view controller that presented the modal view controller should also take responsibility for dismissing it whenever possible. Although there are several techniques for notifying a parent view controller that it should dismiss its modally presented child, the preferred technique is delegation.
There was a good example in the CoreDataRecepies sample code when adding a recipe that fit what I was trying to do.
Upvotes: 1
Reputation: 8357
i.e., at the "same time" view[Will|Did]Disappear:
is being called on the modal view controller as its view is being dismissed, the view[Will|Did]Appear:
are sent to the view controller that is being revealed
the code in here should not really need to differ from the reveal code you used when it was first displayed,
if you need data passed back from the modal controller to the one that displayed it, generally the code that dismisses the modal controller lets the other one know
parentController.item = self.chosenItem;
[parentController dismissModal…
Upvotes: 0