显示 显示细节 目前的形式 弹出窗口展示 自定义

它们之间的区别是什么?我找不到任何相关文件。以前有一些是我在谷歌搜索中找到的,但现在没有了:https://developer.apple.com/library/ios/recipes/xcode_help-interface_builder/articles-storyboard/StoryboardSegue.html


下面是segue的快速总结和每种类型的示例。

Show——将目标视图控制器推到导航堆栈上,从右向左滑动,提供一个返回按钮——如果没有嵌入到导航控制器中,它将以模态方式呈现 例如:在“设置”中,轻按“常规>关于”

显示细节-用于分屏视图控制器,在多列界面中替换次要视图控制器,或者如果折叠为一列,它将推入导航控制器 示例:在Messages中,点击一个对话将显示对话的详细信息——在两列布局中替换右侧的视图控制器,或者在单列布局中推该对话

模态呈现——以模态呈现和转换样式定义的各种方式在当前视图控制器之上呈现一个视图控制器——最常用于在从底部向上动画的工作表中呈现一个视图控制器 示例:在“设置”中选择“人脸ID和密码”

弹窗显示——当在iPad上运行时,目标会出现在一个弹窗中,点击外面的任何地方都将取消它——弹窗在iPhone上也支持,但默认情况下它将以模式方式显示视图控制器 示例:点击日历中的+按钮

自定义-你可以实现自己的自定义segue,并控制它的行为

嵌入——你可以将一个视图控制器嵌入到另一个视图控制器中,比如导航、标签栏、分屏视图控制器以及自定义容器

Unwind -你可以使用Unwind segue导航回前一个视图控制器,即使有很多屏幕被推送/显示在上面,所有这些屏幕都将被解散

已弃用的segue本质上是上面描述的那些非自适应的等等物。这些segue类型在iOS 8中被弃用:Push, Modal, Popover, Replace。

要了解更多信息,您可以阅读使用segue文档,该文档还解释了segue的类型以及如何在故事板中使用它们。也可以看看WWDC 2014的会议216用UIKit构建自适应应用程序。他们讨论了如何使用这些新的自适应segue来构建自适应应用,他们还构建了一个使用这些segue的演示项目。

文档似乎已经移动到这里:https://help.apple.com/xcode/mac/8.0/#/dev564169bb1

不能复制这里的图标,但这里是描述:

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.

为了清晰起见,我想用这些动图来说明@Joey的答案:

Show

显示细节

目前的形式

以弹窗形式呈现

对于那些喜欢更实用的学习,在dock中选择segue,打开属性检查器并在不同类型的segue之间切换(下拉“Kind”)。这将显示针对每个选项的特定选项:例如,你可以看到“呈现模式”允许你选择转换类型等。