Storyboard里面的几种Segue区别:push,modal,popover,replace和custom(转载) (

来源:互联网 发布:靠谱欧洲代购淘宝店 编辑:程序博客网 时间:2024/05/29 16:10


storyboard中,segue有几种不同的类型,在iphoneipad的开发中,segue的类型是不同的。

iphone中,segue有:pushmodal,和custom三种不同的类型,这些类型的区别在与新页面出现的方式。

而在ipad中,有pushmodalpopoverreplacecustom五种不同的类型。

 

 

modal 模态转换

 

最常用的场景,新的场景完全盖住了旧的那个。用户无法再与上一个场景交互,除非他们先关闭这个场景。

是在viewController中的标准切换的方式,包括淡出什么的,可以选切换动画。

Modalview:就是会弹出一个view,你只能在该view上操作,而不能切换到其他view,除非你关闭了modalview.

Modal View对应的segue type就是modal segue

*Modal:Transition to another scene for the purposes of completing a task.user在弹出的modalview里操作完后,就应该dismiss the modal view scene然后切换回the originalview.

 



push


Push类型一般是需要头一个界面是个Navigation Controller的。

是在navigation View Controller中下一级时使用的那种从右侧划入的方式

*Push:Create a chain of scenes where the user can move forward or back.segue type是和navigation viewcontrollers一起使用。

 

 

popover(iPad only)

 

popover 类型,就是采用浮动窗的形式把新页面展示出来

*Popover(iPad only):Displays the scene in a pop-up “window” over top of the current view.

 

 

*Replace (iPad only):

 

替换当前scene

Replace the current scene with another. This is used in some specialized iPad viewcontrollers (e.g. split-view controller).

 

 

custom


就是自定义跳转方式啦。

*Custom:Used for programming a customtransition between scenes.

Storyboard中使用自定义的segue类型

http://ryan.easymorse.com/?p=72

 

 



代码执行segue

 

目前所知道的情况,Push型的Segue必须拥有Navigation Controller

在StoryBoard中建立的Segue,是直接跳转的,不方便添加额外的条件判断,如果要做登录之类的功能,必须动态执行Segue操作

 

首先在StoryBoard中建立Segue,不从按钮等控件建立,而是从ViewController建立(这样的话必须指定Identifier)

建立完毕后,使用代码:

[self performSegueWithIdentifier:@"segueXXX" sender:self];

利用Identifier指定要执行的Segue.






参考资料:

 

使用StoryBoard:用Segue传递数据

http://www.cnblogs.com/mybkn/archive/2012/03/22/2411842.html 

 

WWDC2011视频之Introduction to Storyboarding摘要

http://blog.sina.com.cn/s/blog_834f346f0100s4jr.html

 

storyboard 遇到一个segue的问题

http://www.cocoachina.com/bbs/simple/?t92552.html

 

iOS: storyboard (2)

http://blog.csdn.net/totogogo/article/details/7361191


IOS开发教程:Storyboard全解析

http://www.dasheyin.com/ios_kai_fa_jiao_cheng_storyboard_quan_jie_xi_-_di_yi_bu_fen.html


IOS中@class和import两种引用文件的区别

http://www.devdiv.com/home.php?mod=space&uid=65729&do=blog&id=10905


Storyboard的简单使用

http://my.oschina.net/plumsoft/blog/53886