Re: Segue


Gerriet M. Denkmann
 

On 20 Sep 2018, at 22:19, Rick Aurbach via Groups.Io <rlaurb=me.com@groups.io> wrote:

I'm not sure I am understanding your problem correctly, but I am wondering about the exact layout of your storyboard. Specifically, are you using a UISplitViewController? The Push (Detail) segue is specific to it.

On an iPhone (particularly in portrait mode), the push-detail segue looks like a simple push, but it is not. You can see this when running on an iPad in Simulator, where you will see both the TableViewController and the Detail controller (in whole or with part of it covered by the TableViewController) side by side. The push detail segue brings the detail controller to the front, covering (hiding) the TableViewController. On a phone, this just looks like a push.

If you don't have a split-view controller, then the segue can't do that (i.e., it can't call UISplitViewController.showDetailViewController) and is apparently doing a simple UIViewController.present instead.

If I’m off on a mistaken tangent here, please excuse the waste of bandwidth.
You are quite right. The Xcode template “Master-Detail App” uses a SplitViewController, and it works fine.
And it works for both iPad and iPhone.

But you can do (iPhone only ?) without a SplitViewController as well:

UINavigationController → UIViewController (Master) → UIViewController (Detail) works as expected.

Three important points:
1. The Master *must* be preceded by an UINavigationController
2. There must be *no* UINavigationController between Master and Detail.
3. The Segue Master to Detail *must* be of Kind: Show (e.g. Push)

This is probably self-evident (and probably also well documented), but it took me more than a day to figure this out.

Kind regards,

Gerriet.

Join cocoa@apple-dev.groups.io to automatically receive all group messages.