What's the difference between all the Selection Segues?

IosIos8Xcode6Segue

Ios Problem Overview


  • Show
  • Show Detail
  • Present Modally
  • Popover presentation
  • Custom

enter image description here

What is the difference between them? I couldn't find any documentation on it. There used to be some which I found in a Google search, but it's now gone: https://developer.apple.com/library/ios/recipes/xcode_help-interface_builder/articles-storyboard/StoryboardSegue.html

Ios Solutions


Solution 1 - Ios

Here is a quick summary of the segues and an example for each type.

Show - Pushes the destination view controller onto the navigation stack, sliding overtop from right to left, providing a back button to return - if not embedded in a navigation controller it will be presented modally
Example: Navigating in Settings, for example tapping General > About

Show Detail - For use in a split view controller, replaces the secondary view controller when in a multi-column interface, or if collapsed to one column it will push in the navigation controller
Example: In Messages, tapping a conversation will show the conversation details - replacing the view controller on the right when in a two column layout, or push the conversation when in a single column layout

Present Modally - Presents a view controller overtop the current view controller in various fashions as defined by the modal presentation and transition style - most commonly used to present a view controller in a sheet that animates up from the bottom
Example: Selecting Face ID & Passcode in Settings

Popover Presentation - When run on iPad, the destination appears in a popover, and tapping anywhere outside will dismiss it - popovers are supported on iPhone as well but by default it will present the view controller modally
Example: Tapping the + button in Calendar

Custom - You may implement your own custom segue and have control over its behavior

Embed - You may embed a view controller into another view controller, such as navigation, tab bar, and split view controllers as well as custom containers

Unwind - You may use an unwind segue to navigate back to a previous view controller, even if there’s many screens pushed/presented on top all of them will be dismissed

The deprecated segues are essentially the non-adaptive equivalents of those described above. These segue types were deprecated in iOS 8: Push, Modal, Popover, Replace.

For more info, you may read over the Using Segues documentation which also explains the types of segues and how to use them in a Storyboard. Also check out Session 216 Building Adaptive Apps with UIKit from WWDC 2014. They talked about how you can build adaptive apps using these new Adaptive Segues, and they built a demo project that utilizes these segues.

Solution 2 - Ios

For clarity, I'd like to illustrate @Joey's answer above with these gifs :

Show

enter image description here

Show Detail

enter image description here

Present Modally

enter image description here

Present As Popover

enter image description here

Solution 3 - Ios

The document has moved here it seems: https://help.apple.com/xcode/mac/8.0/#/dev564169bb1

Can't copy the icons here, but here are the descriptions:

> - Show: Present the content in the detail or master area depending on the content of the screen. > > If the app is displaying a master and detail view, the content is pushed onto the detail area. If the app is only displaying the master or the detail, the content is pushed on top of the current view controller stack. > > - Show Detail: Present the content in the detail area. > > If the app is displaying a master and detail view, the new content replaces the current detail. If the app is only displaying the master or the detail, the content replaces the top of the current view controller stack. > > - Present Modally: Present the content modally. > > - Present as Popover: Present the content as a popover anchored to an existing view. > > - Custom: Create your own behaviors by using a custom segue.

Solution 4 - Ios

For those who prefer a bit more practical learning, select the segue in dock, open the attribute inspector and switch between different kinds of segues (dropdown "Kind"). This will reveal options specific for each of them: for example you can see that "present modally" allows you to choose a transition type etc.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionUserView Question on Stackoverflow
Solution 1 - IosJordan HView Answer on Stackoverflow
Solution 2 - IosAmbroise CollonView Answer on Stackoverflow
Solution 3 - IosendavidView Answer on Stackoverflow
Solution 4 - Iosjreft56View Answer on Stackoverflow