My root view controller is a UITabBarController. I'm trying to present a modal view controller over one of the tab bar controller's view controllers, but still allow the tab bar to be used to go to a different tab - in other words, I would like for the modal to only interrupt to the flow of that particular tab, not the entire app.
To do this, I've set the presenting view controller's presentation style as 'Over Current Context' in storyboard. The problem I'm having is that after presenting the modal view controller and selecting a new tab, the presenting view controller's view is removed from the window, and isn't added back to the window when dismissing the presented view controller. After dismissing the view controller, moving to another tab and then coming back finally puts the presenting view controller back into the window.
I've reproduced my problem using the 'Tabbed' template in Xcode.
After presenting modal - I've added transparency to the presented view controller to easily see what's going on in the presented view controller.
Changing to second tab and then back - the presenting view controller's view has now been removed.
Dismissing the modal leaves the presenting view controller with it's view still removed from the window. Going to tab 2 and returning adds the view back to the window.
I'm hoping this is something simple I've overlooked in storyboard, but the fact that I can present the modal and see the presented view controller behind it before changing tabs makes me think I have things set up correctly.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…