Presenting a view controller from a collapsed split view controller's detail view controller goes back to the master view controller when the presenting view controller is dismissed

I tried searching around, but didn't find anything. I have a master-detail UISplitViewController. When the split view controller is collapsed, the detail view controller can present a modal UINavigationController using -presentViewController:animated:.


The problem is, when the modal view controller is dismissed, the split view controller ceases to show the detail view controller, and shows the user the master view controller instead. I don't want that to happen; I want it to show the detail view controller, as it did before the modal view controller was presented. How do I do this? I'm using the iOS 9 SDK, but I need this to work in iOS 8 as well.

Answered by TungstenT in 93902022

In case anyone else ever runs into this problem, I figured it out. The problem was, the UISplitViewController's master view controller wasn't a UINavigationController, but was a different view controller that contained a UINavigationController. Once I reversed this relationship, so the UINavigationController was the master view controller, then it worked as expected.

Hi TungstenT


How are you dismissing the presented view controller? Are you using an unwind segue. And if so, where is the unwind action located?

The controller is being dismissed by calling -dismissViewController:animated: on the presenting view controller. We're not using an unwind segue.

Hi TungstenT


I don't have any idea as to why you would be seeing this behavior then. If nobody else chimes in you can open a Technical Support Incident and myself or one of my colleagues can look into this issue further. Be sure to include a sample project with the TSI.

Accepted Answer

In case anyone else ever runs into this problem, I figured it out. The problem was, the UISplitViewController's master view controller wasn't a UINavigationController, but was a different view controller that contained a UINavigationController. Once I reversed this relationship, so the UINavigationController was the master view controller, then it worked as expected.

Presenting a view controller from a collapsed split view controller's detail view controller goes back to the master view controller when the presenting view controller is dismissed
 
 
Q