In my application, I am presenting a modal view controller, but I'm having issues which I believe are caused by the fact that I am presenting the view controllers from a child view controller.
The call for presentViewController: animated:
is coming from a view controller which is on the stack of a navigation controller, and that navigation controller is contained in another view controller using the "Container View" in Interface Builder. This outer container view controller has a persistent banner at the top of the screen.
When the view controller is presented, it animates the scroll up, and when it gets to the top, it goes underneath the banner of the container view controller. However, once the animation finishes it appears in front again, but no interaction is possible on the part of the modal view controller that would be covered by the banner. What is the proper way to present a modal view controller from a child view controller?
EDIT:
I've tried accessing the container view controller directly, which works at first, but once the modal view controller is dismissed the container view somehow expands to fill the entire screen, overlapping the entire banner.
EDIT:
Screenshot:
The modal view controller is sliding up and appearing underneath the banner at the top, then suddenly jumping to the front.
Yes a presented VC can present another VC. FWIW when you dismiss VC3, it will only go back to VC2. It won't go back to VC1. Save this answer.
I also encountered the issue: when calling: dismissViewControllerAnimated
from a view controller presented modally from a child view controller, the child view controller is also dismissed.
After a bit of playing around in interface builder, I've managed to solve it.
Just change the modally presented view controller Presentation style to Over Full Screen. (the default is Full Screen)
Swift
// In the viewController class you're presenting modally
self.modalPresentationStyle = .overFullScreen
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With