I have something like a modal view controller that I need to display over my other controllers. I do not use the function of a regular modal controller ( presentViewController:
and friends), since I need better control over the process. Instead, I use the view controller's restriction function ( addChildViewController:
method group).
The containment function makes the code pretty simple. When I need to present a โmodalโ view controller, I add it as a child to the view manager hierarchy, and everything works as expected. One small catch is that regular view controllers are wrapped in a navigation controller. Therefore, I have to add a modal controller as a child of the navigation controller, otherwise it will be closed by the navigation panel and toolbar.
Now the problem is that calling addChildViewController:
on the navigation controller also sets the new controller as topViewController
, as if the controller was clicked using the usual pushViewController:
method. This means that while the modal controller is being displayed, the regular controller below it does not receive appearance and rotation callbacks.
Does this sound like a mistake, or am I missing something?
source share