Is your UISplitViewController
the root view controller? It can exhibit strange behavior if not. Per Apple:
Note
"...Although it is possible to install a split view controller as a child in some other container view controllers, doing is not recommended in most cases. Split view controllers are normally installed at the root of your app’s window. ..."
I've used this (called from Detail view controller, using the Split View Controller with two nav controllers.) At this point I wanted to reset the nav stacks:
let firstVC = self.storyboard?.instantiateViewController(withIdentifier: "FirstViewController") as! FirstViewController
let secondVC = self.storyboard?.instantiateViewController(withIdentifier: "SecondViewController") as! SecondViewController
// Get a reference the the Master View nav controller
let masterNav = self.splitViewController!.viewControllers[0] as! UINavigationController
// Set desired VC's as nav stack RootViewControllers
self.navigationController?.setViewControllers([matchVC], animated: true)
masterNav.setViewControllers([masterMatchTableView], animated: true)
You could call .pushViewController
on both Navigation Controllers instead, if you want to maintain the nav stack.
If you're still working on this, post some code and I'd be happy to take a look at it.
edit:
So, you can't modally present a Split View Controller:
https://developer.apple.com/library/content/documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/SplitViewControllers.html
A split view controller must always be the root of any interface you create. In other words, you must always install the view from a UISplitViewController object as the root view of your application’s window. The panes of your split view interface may then contain navigation controllers, tab bar controllers, or any other type of view controller you need to implement your interface. Split view controllers cannot be presented modally.
The code snippet I posted above will present both Master and Detail Views at the same time. Or, you could present a new VC as the Detail View, and set the UISplitViewController.preferredDisplayMode = .primaryHidden
to modally present a single VC.