97

What do the different segues do in Xcode 6?

Pang
  • 9,564
  • 146
  • 81
  • 122
Red
  • 1,425
  • 1
  • 10
  • 15
  • 5
    Check out http://stackoverflow.com/questions/25966215/whats-the-difference-between-all-the-selection-segues – Gismay Oct 09 '14 at 22:11
  • 2
    duplicate? http://stackoverflow.com/questions/25966215/whats-the-difference-between-all-the-selection-segues – Gerald Mar 27 '16 at 10:28
  • 2
    Possible duplicate of [What's the difference between all the Selection Segues?](http://stackoverflow.com/questions/25966215/whats-the-difference-between-all-the-selection-segues) – Suhaib Jan 24 '17 at 21:21

1 Answers1

184

1. Show - Pushes the destination view controller onto the navigation stack, moving the source view controller out of the way (destination slides overtop from right to left), providing a back button to navigate back to the source - on all devices.

Example: Navigating inboxes/folders in Mail.

2. Show Detail - Replaces the detail/secondary view controller when in a UISplitViewController with no ability to navigate back to the previous view controller.

Example: In Mail on iPad in landscape, tapping an email in the sidebar replaces the view controller on the right to show the new email.

3. Present Modally - Presents a view controller in various different ways as defined by the Presentation option, covering up the previous view controller - most commonly used to present a view controller that animates up from the bottom and covers the entire screen on iPhone, but on iPad it's common to present it in a centered box format overtop that darkens the underlying view controller.

Example: Tapping the + button in Calendar on iPhone.

4. Popover Presentation - When run on iPad, the destination appears in a small popover, and tapping anywhere outside of this popover will dismiss it. On iPhone, popovers are supported as well but by default if it performs a Popover Presentation segue, it will present the destination view controller modally over the full screen.

Example: Tapping the + button in Calendar on iPad (or iPhone, realizing it is converted to a full screen presentation as opposed to an actual popover).

5. Custom - You may implement your own custom segue and have complete control over its appearance and transition.

Rajesh Loganathan
  • 11,129
  • 4
  • 78
  • 90
  • 2
    **Show** detail: _The default implementation of this method calls the targetViewController(forAction:sender:) method to locate an object in the view controller hierarchy that overrides this method. It then calls the method on that target object, **which displays the view controller in an appropriate way**. If the targetViewController(forAction:sender:) method returns nil, this method uses the window’s root view controller to **present vc modally**._ – Gehlen Jan 17 '19 at 17:59
  • Show: What if there is no navigation stack? – Roman Jun 01 '22 at 06:59