334
  • 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

tryKuldeepTanwar
  • 3,490
  • 2
  • 19
  • 49
User
  • 23,729
  • 38
  • 124
  • 207
  • same link is now officially https://help.apple.com/xcode/mac/8.0/#/dev7be043cad. Archived link is https://web.archive.org/web/20140604140305/https://developer.apple.com/library/ios/recipes/xcode_help-interface_builder/articles-storyboard/StoryboardSegue.html – Cœur Jun 28 '17 at 14:08
  • segue documentation link is https://help.apple.com/xcode/mac/8.0/#/dev564169bb1 – Cœur Jun 28 '17 at 14:15

4 Answers4

576

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.

Jordan H
  • 52,571
  • 37
  • 201
  • 351
  • can you define the difference between Push and Show segues? – MetalJr Jan 10 '15 at 13:11
  • @Gautham Push is the non-adaptive and deprecated seque that Show has replaced. – Jordan H Jan 10 '15 at 16:39
  • Thanks @Joey. I can see that. I have another question for you. I can see Show is adaptive in the context of Size classes. Do you think I'm missing something here? – MetalJr Jan 11 '15 at 05:11
  • @Gautham Sorry I don't understand what the question is. Yes show is adaptive and push is not. – Jordan H Jan 11 '15 at 16:44
  • @Joey as a newbie on ios dev I wanna say thanks for making this clear. 1).But what is the difference between show/modal segue? I mean if you add your own custom back button to the VC showed as modal. 2.) What type of segue should I use if I want to reset the navigation stack? Eg. User click on account and are then taken to their account page in the app. The account page should then display a hamburger icon/menu instead of a back arrow to the prev VC? – user2722667 Jul 26 '15 at 14:11
  • Are any of the segues dependent upon whether a view is within a view controller container? i.e. can there be a 'show' without a navigation controller? – Ian Warburton Nov 12 '15 at 15:22
  • Yes @IanWarburton the context does determine which segues are available. If there is no navigation controller, you cannot show aka push. (You can just implement the nav controller and hide its navigation bar.) – Jordan H Nov 12 '15 at 16:16
  • @Joey The option to Show/Push still seems to be there though when I don't have a navigation controller. – Ian Warburton Nov 12 '15 at 16:30
  • @IanWarburton If you 'show' segue from a container view, the app will crash when it attempts to perform the segue. Use the 'embed' segue in that situation. – Jordan H Nov 12 '15 at 17:10
  • @Joey I think they ought to filter the segue selector based on the context. – Ian Warburton Nov 12 '15 at 17:57
  • @Joey Great answer. Let's say I go from `viewControllerA` to `viewControllerB` and then go back to `viewControllerA` so of the 4 ways of segueing, which one of them would set `viewControllerB` back to **nil** and necessitate creating `viewControllerB` every time and as a result make us go through `viewDidLoad` of `viewControllerB` upon every segue? – mfaani Sep 15 '16 at 15:46
  • I wonder what it would be like to have this many upvotes on a SO answer.... >5k reputation points ✅. – Eric33187 Apr 01 '21 at 06:36
244

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

Ambroise Collon
  • 3,839
  • 3
  • 18
  • 37
25

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.

Pang
  • 9,564
  • 146
  • 81
  • 122
endavid
  • 1,781
  • 17
  • 42
1

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.

jreft56
  • 199
  • 1
  • 12