Setup on iOS iPad Simulator 5.0.1:
Root controller X, UIViewController A, UIViewController B
A.definesPresentationContext = YES;
// Skipped: set modal presentation props.
[A presentViewController: B, animated: YES, completion: nil];
If I check A.presentedViewController, the result is B – correct.
If I check B.presentingViewController, the result is X
How is that possible? It also leads to the problem that I don’t get informed in A if B gets dismissed (I’m overriding dismissViewController: in A).
What do I have to do to make a the presenting controller?
The Methods
[A presentViewController: B, animated: YES, completion: nil];presents the controller B as a Modal, and all modals are presented from the rootViewController, therefor presentingViewController is X.If you want to know in A when B is dismissed you will have to fire an NSNotification in B’s viewDidDisappear so A can catch that notification