所有选择区段之间有什么区别?

本文翻译自:What's the difference between all the Selection Segues?

  • Show 节目
  • Show Detail 查看详细
  • Present Modally 目前模态
  • Popover presentation Popover演示文稿
  • Custom 习惯

在此输入图像描述

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 曾经有一些我在Google搜索中找到的,但它现在已经消失了: https//developer.apple.com/library/ios/recipes/xcode_help-interface_builder/articles-storyboard/StoryboardSegue.html


#1楼

参考:https://stackoom.com/question/1KWZV/所有选择区段之间有什么区别


#2楼

Here is a quick summary of the segues and an example for each type. 以下是segue的快速摘要以及每种类型的示例。

Show - Pushes the destination view controller onto the navigation stack, sliding overtop from right to left, providing a back button to return to the source - or if not embedded in a navigation controller it will be presented modally 显示 - 将目标视图控制器推到导航堆栈上,从右向左滑动,提供返回按钮以返回到源 - 或者如果未嵌入导航控制器,它将以模态方式显示
Example: Navigating inboxes/folders in Mail 示例:在Mail中导航收件箱/文件夹

Show Detail - For use in a split view controller, replaces the detail/secondary view controller when in an expanded 2 column interface, otherwise if collapsed to 1 column it will push in a navigation controller 显示详细信息 - 用于拆分视图控制器时,在扩展的2列接口中替换详细/辅助视图控制器,否则如果折叠为1列,则将推入导航控制器
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 in various animated fashions as defined by the Presentation option, covering 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, or on iPad it's common to present it as a centered box that darkens the presenting view controller 呈现模式 - 呈现由Presentation选项定义的各种动画时尚的视图控制器,覆盖前一个视图控制器 - 最常用于呈现从底部动画并覆盖iPhone上的整个屏幕的视图控制器,或者在iPad上它常见的是将其呈现为居中的框,使呈现视图控制器变暗
Example: Selecting Touch ID & Passcode in Settings 示例:在“设置”中选择“触摸ID和密码”

Popover Presentation - When run on iPad, the destination appears in a popover, and tapping anywhere outside of this popover will dismiss it, or on iPhone popovers are supported as well but by default it will present the destination modally over the full screen Popover演示文稿 - 在iPad上运行时,目标显示在弹出窗口中,点击此弹出框外的任何位置都会忽略它,或者也支持iPhone弹出窗口,但默认情况下它会在整个屏幕上以模态方式显示目标
Example: Tapping the + button in Calendar 示例:点击日历中的+按钮

Custom - You may implement your own custom segue and have control over its behavior 自定义 - 您可以实现自己的自定义segue并控制其行为

The deprecated segues are essentially the non-adaptive equivalents of those described above. 不推荐的segues本质上是上述那些的非自适应等价物。 These segue types were deprecated in iOS 8: Push, Modal, Popover, Replace. 这些segue类型在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. 有关详细信息,您可以阅读使用Segues文档 ,该文档还解释了segue的类型以及如何在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. 另请参阅WWDC 2014中的会话216 使用UIKit构建自适应应用程序。他们讨论了如何使用这些新的自适应分段构建自适应应用程序,并且他们构建了一个利用这些分段的演示项目。


#3楼

The document has moved here it seems: https://help.apple.com/xcode/mac/8.0/#/dev564169bb1 该文件似乎已移至此处: 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. 自定义 :使用自定义segue创建自己的行为。


#4楼

For clarity, I'd like to illustrate @Joey's answer above with these gifs : 为清楚起见,我想用这些GIF来说明@ Joey上面的答案:

Show 节目

在此输入图像描述

Show Detail 查看详细

在此输入图像描述

Present Modally 目前模态

在此输入图像描述

Present As Popover 作为Popover呈现

在此输入图像描述


#5楼

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"). 对于那些更喜欢更实用的学习的人,选择停靠栏​​中的segue,打开属性检查器并在不同类型的segue之间切换(下拉菜单“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. 这将显示每个选项的特定选项:例如,您可以看到“存在模态”允许您选择转换类型等。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值