Search code examples
iosuisplitviewcontrollerxcode9.1

UISplitViewController pushes new detail controller, doesn't update side detail


I'm trying to add a split view controller to my existing project so that it shows over the existing content in a new window.

The template project from Apple works as expected. For testing, I simply copied the storyboard items from the template project onto my own storyboard, gave the splitViewController a storyboard identifier and copied the classes.

When a plus phone is turned landscape it shows the master and detail side-by-side properly. However, when I tap on a master entry it pushes a new detail controller instance over the master content instead of using the secondary detail view on the right for the content.

This is how I show show the splitViewController:

    guard let splitViewController = storyboard.instantiateViewController(withIdentifier: "MasterViewController") as? UISplitViewController else { return }

    splitViewController.delegate = self
    splitViewController.preferredDisplayMode = .automatic
    self.conversationWindow = UIWindow(frame: UIScreen.main.bounds)
    self.conversationWindow?.windowLevel = UIWindowLevelNormal + 0.1
    self.conversationWindow?.rootViewController = splitViewController
    self.conversationWindow?.makeKeyAndVisible()

Before tapping entry:

Before tapping entry

After tapping entry:

After tapping entry

Storyboard:

Storyboard

Anyone ever experience this?


Solution

  • Found my answer. Seems copying the views changed the segue type from showDetails to show