IOS学习笔记---segue
来源:互联网 发布:java中interrupt用法 编辑:程序博客网 时间:2024/06/09 17:43
Before asegue executes, the system gives the view controller involved a chance to prepare by calling prepareForSegue:
. This is exactly the point at which you want to check to see whether the user tapped the Done button, and if so, create a new to-do item. You can check which one of the buttons got tapped, and if it was the Done button, create the item.
You have two view controllers configured in the storyboard, but there’s no connection between them. Transitions between scenes are called segues.
The push navigation is working just as it’s supposed to—but it’s not quite what you want when adding items. Push navigation is designed for a drill-down interface, where you’re providing more information about whatever the user selected. Adding an item, on the other hand, is amodal operation—the user performs some action that’s complete and self-contained, and then returns from that scene to the main navigation. The appropriate method of presentation for this type of scene is a modal segue.
To change the segue style
In the outline view or on the canvas, select the segue from the table view controller to the add-to-do-item view controller.
In the Attributes inspector, choose Modal from the pop-up menu next to the Style option.
Because a modal view controller doesn’t get added to the navigation stack, it doesn’t get a navigation bar from the table view controller’s navigation controller. However, you want to keep the navigation bar to provide the user with visual continuity. To give the add-to-do-item view controller a navigation bar when presented modally,embed it in its own navigation controller.
To add a navigation controller to the add-to-do-item view controller
In the outline view, select View Controller.
With the view controller selected, chooseEditor > Embed In > Navigation Controller.
As before, Xcode adds a navigation controller and shows the navigation bar at the top of the view controller. Next, configure this bar to add a title to this scene as well as two buttons,Cancel and Done.
In addition to push and modal segues, Xcode provides an unwind segue. This segue allows users to go from a given scene back to a previous scene, and it provides a place for you to add your own code that gets executed when users navigate between those scenes. You can use an unwind segue to navigate back fromXYZAddToDoItemViewController
to XYZToDoListViewController
.
An unwind segue is created byadding an action method to the destination view controller (the view controller you want to unwind to). A method that can be unwound to must return an action (IBAction
) and take in a storyboard segue (UIStoryboardSegue
) as a parameter. Because you want to unwind back toXYZToDoListViewController
, you need to add an action method with this format to theXYZToDoListViewController
implementation.
- IOS学习笔记---segue
- IOS学习之Segue
- 学习笔记:关于segue
- IOS开发学习笔记(1) - 不通过storyboard segue 来切换视图
- iOS segue
- ios-Segue
- [赵三哥Swift学习笔记]Segue
- 【IOS 开发学习总结-OC-55】故事板中 segue 的 push、modal、popover、replace、custom 学习笔记
- iOS学习笔记—— Storyboard里面的几种Segue区别:push,modal,popover,replace和custom
- iOS学习笔记—— Storyboard里面的几种Segue区别:push,modal,popover,replace和custom
- iOS开发笔记——利用segue传参
- iOS开发笔记——利用segue传参
- iOS开发笔记——利用segue传参
- IOS-笔记19(Model Segue,Camera,File System)
- 学习笔记-斯坦福iOS7-第十五课:MapKit和嵌入Segue
- iOS: Segue & Delegate
- ios Segue传值
- iOS Segue使用
- ASM与存储容灾
- 将图片序列化和饭序列化
- mergesort
- 黑马程序员-java面试_数组
- 第六章 - 图像变换 -梯度和Sobel导数(cvSobel)
- IOS学习笔记---segue
- 【黑马程序员】java-正则表达式
- 国际佛教僧尼总会声明
- 常用汽车电子工具集的开发——网络协议
- WPF获取窗口句柄
- Easyui和IE浏览器的兼容问题
- 【Matlab学习笔记】【编程实例】二(将两幅灰度图片调整成相同的尺寸,然后左右拼接到一起)
- latch free等待事件
- 黑马程序员--面向对象的三大基本特征(多态)(04)