React when a ChildViewController presents a ModalViewController

Hi,


I've got a deep hierarchy of ViewControllers and child ViewControllers.


Now one of those child ViewControlers presents a Modal ViewController, but it's just displayed on top, without "definesPresentationContext".


How can a ViewController further up the hierarchy get this event and react to this? It's still visible, so all the -willDisappearAppear etc stuff isn't fired.


Thanks!

Replies

The push solution: The view controller that is presenting the child can also post an NSNotification that the parents can receive.


The pull solution: any parent view controller can access its most distant child using:


    UIViewController* childController =self;
    while( childController.presentedViewController &&
          childController != childController.presentedViewController ){
        childController = childController.presentedViewController;
    }