`
dcj3sjt126com
  • 浏览: 1825236 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

IOS: Unwind Segues

    博客分类:
  • IOS
 
阅读更多

原文: http://www.intertech.com/Blog/iOS-Unwind-Segues/

In iOS 5, we were introduced to Storyboards and Segues.  While these features simplified the navigation process in our apps, we weren’t given a way to define a return to previous modal scenes via Interface Builder.

You may have noticed that in iOS 6, a green icon has been added to the control bar of each scene in the Storyboard.

exitIcon

This is a new, and surprisingly overlooked feature for iOS 6, which provides the missing “return” functionality.  It’s called an “unwind segue.”

The process is simple:

  • Add a private method inside each View Controller you wish to “unwind” to (a common mistake is to add this code into the View Controller you wish to unwind from).
  • This method includes one (and only one) parameter that’s a pointer to a UIStoryboardSegue, and a return type of IBAction .
  • The name of this method can be whatever you’d like.  However, all of the unwind segues will be listed in one place,so it’s a good idea to pick a descriptive naming pattern, such as unwindToRootVC.
  • There is no need to have anything in the body of this method.  The signature is what’s important.
   1: -(IBAction)unwindToRootVC:(UIStoryboardSegue *)segue
   2: {
   3:     // Nothing needed here.
   4: }
  • Inside your Storyboard, hold the control key down while dragging from your button (or other control) to the green exit icon below.

dragToExit

  • You will see a list of every unwind segue available here… that’s why coming up with a consistent and descriptive naming pattern is important.

selectUnwind

That’s it!  You are now able to return to any previous scene simply by selecting the appropriate unwind segue.  Also, unlike following a ‘regular’ segue, this will use not create a new object for every request!



Read more: http://www.intertech.com/Blog/ios-unwind-segues/#ixzz39OhH56Aj 
Follow us: @IntertechInc on Twitter | Intertech on Facebook

分享到:
评论

相关推荐

    Programming iOS 9(2015)

    Stay up-to-date on iOS 9 innovations, such as the new layout constraint notation, expanded UIKit dynamics, revised unwind segues, iPad multitasking, and the Contacts framework. All example code is ...

    Programming iOS 9 pdf 2015.12 完美无错版

    Stay up-to-date on iOS 9 innovations, such as the new layout constraint notation, expanded UIKit dynamics, revised unwind segues, iPad multitasking, and the Contacts framework. All example code is ...

    gperftools-unwind-graphviz.20200119.tar.gz

    gperftools安装包和依赖包; 安装使用说明; 示例代码: #include #include void func1(void) { int i = 0; while (i ) { ++i; } return; } void func2(void) { int i = 0;...}

    storyboard_unwindSegue

    storyboard的unwind segue用法小结,博客文章:http://blog.csdn.net/kid_devil/article/details/23218195

    Unwind Library Project-开源

    Unwind Library Project 旨在为 C 语言开发通用异常处理工具和 unwind 清理处理程序

    IDA_ARM_Unwind:IDA插件,调试手臂时展开堆栈跟踪

    IDA ARM Unwind Plugin 功能 使用 IDA 调试 arm 调试时,打印实时的栈回溯。 IDA 的菜单栏有一处功能:Debugger -> Debugger windows -> Stack trace (Ctrl + Alt + S),在调试 x86、x64、arm64 的程序时它的功能是...

    iOS-StoryboardPushSegue-Swift:两个 Storyboard 场景之间的基本推送转场

    启用 unwind/back 功能需要将此 IBAction 放置在根 ViewController 类中: @IBAction func unwindSegue ( segue : UIStoryboardSegue) { } 在 Storyboard 中,向目标场景添加一个按钮,然后按住 Ctrl 键将其拖动...

    plcrashreporter:适用于iOS,macOS和tvOS的可靠的开源崩溃报告

    PLCrashReporter PLCrashReporter是一个可靠的开源库,提供了可在iOS,macOS和tvOS上使用的进程内实时... 最低支持的平台:iOS 9,macOS 10.9,tvOS 9,Mac Catalyst 13.0。 解码崩溃报告 崩溃报告以Protobuf编码的

    Unwind_hotel

    Unwind_hotel

    libtool-1.3.2.tar.gz

    这是ubuntu中软件 libtool-1.3.2

    unwinder:将较低级别的对象复制到对象的第一级别

    放松 展开模块将深层对象复制到第一级。 它能做什么 如果原始对象是: { "first" : { "second" : { "third" : "data" } } } Unwind 将返回一个对象,如: ... var unwind = require ( 'unwind' ) , you

    MongoDBV4.2逻辑视图测试脚本.js

    MongoDB视图测试创建脚本及测试数据创建脚本;创建视图的基本方式及进阶方式。如:用$unwind分解$lookup中的as数组,使之扁平化返回;使用$project 重命名字段等

    androiddemounwindso

    android demo unwind so

    gounwind:使用框架指针展开实验栈堆栈

    狂风 gounwind是一个很小的Go库,它代替了 。 它的存在是为了说明从理论上讲,使用帧指针时,堆栈展开的简单性和快速性。 与runtime.Callers()相比,gounwind是: 〜快50 与 完全不安全的生产使用 ...

    支持С++ 20 std :: stop_token来中断阻塞Linux系统调用,而不会引发任何异常。-C/C++开发

    对于终止,目标线程将引发特定异常(如Glibc的abi :: __ forced_unwind),除非重新抛出,否则无法处理该异常。 在同步情况下,只要目标线程达到某些功能(取消点),就会发生这种情况。 它们大多数是syscalls包装器...

    MongoDBV4.2物化视图测试脚本.js

    MongoDB视图测试创建脚本及测试数据创建脚本;创建物化视图的基本方式及进阶方式。如:用$unwind 、$replaceRoot分解$lookup中的as数组,使之扁平化返回;使用$project 重命名字段;使用$merge输出物化视图等

    vscode配置EasyX工程

    已解决配置vscode中报:undefined references to问题。 1、内部含有easyx4mingw的easyx.h和graphics.h文件、以及静态库libeasyx.a 2、已配置好的vscode工程 需要改一下c_cpp_properties.json的编译器路径、以及...

    libunwind:libunwind的个人开发克隆

    Linux / PARISC:运行良好,但是C库缺少unwind-info。 HP-UX / IA-64:多数有效,但已知有一些严重限制。 MIPS:新添加。 Linux / AArch64:运行良好。 Linux / PPC64:新添加。 Linux / SuperH:新添加。 FreeBSD ...

    mongo-current-op:显示mongo当前操作

    package_main--------------------------aggregate on "collection"[{"$unwind":"$subDocs"},{"$group":{"_id":{"status":"$status","subDocs":"$subDocs"},"count":{"$sum":1}}},{"$sort":{"count":-1}}]~/

    102-garbage-after-endif.rar_after

    libunwind - a platform-independent unwind library.FIXME for AArch64.

Global site tag (gtag.js) - Google Analytics