HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了【IOS 开发学习总结-OC-55】故事板中 segue 的 push、modal、popover、replace、custom 学习笔记大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

故事板 storyboard中 segue 的 push、modal、popover、replace、custom 学习笔记

storyboard中 segue的push、modal、popover、replace、custom

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

@H_359_11@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@R_772_10270@回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一起使用。

custom

就是自定义跳转方式啦。
*Custom:Used for progrAMMing a customtransition between scenes.
在Storyboard中使用自定义的segue类型

@H_675_35@popover (iPad only)

popover 类型,就是采用浮动窗的形式把新页面展示出来
*Popover(iPad only):Displays the scene in a pop-up “window” over top of the current view.

@H_262_41@@H_262_41@【IOS 开发学习总结-OC-55】故事板中 segue 的 push、modal、popover、replace、custom 学习笔记

replace (iPad only):

替换当前scene,
replace the current scene with another. This is used in some specialized iPad viewcontrollers (e.g. split-view controller).

视图之间的数据传递

当你从当前场景中触发一个segue的时候,系统会自动调用prepareForSegue:sender:这个方法。如果你想从一个界面切换到里另一个界面的时候传递数据,你应该override这个方法
A -> B
想把数据 NSString A_data 从AController传到BController,则在BController中
@property 一个NSString data
然后在AController中添加方法

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    NSLog(@"The segue id is %@",segue.identifier );
    UIViewController *desTination = segue.desTinationViewController;  
    if ([desTination respondsToSELEctor:@SELEctor(setData:)])
    {
        [desTination SETVALue:@"这是要传递的数据" forKey:@"data"];
    }   
}

之后,Bcontroller中的data属性,就接收到数据了。

ViewController之间的跳转

1、如果在 Storyboard中当前的 ViewController和要跳转的ViewController之间的segue存在,则可以执行performSegueWithIdentifier:sender:这个方法实现跳转
2、如果目标ViewController存在Storyboard中,但是没有segue。你可以通过UIStoryboard的instantiateViewControllerWithIdentifier:这个方法获取到它,然后再用你想要的方式实现跳转,如:压栈。
3、如果目标ViewController不存在,那就去创建它吧。

ios 的 segue 类型图

@H_262_41@@H_262_41@【IOS 开发学习总结-OC-55】故事板中 segue 的 push、modal、popover、replace、custom 学习笔记

资料:http://www.lvtao.net/ios/523.html

大佬总结

以上是大佬教程为你收集整理的【IOS 开发学习总结-OC-55】故事板中 segue 的 push、modal、popover、replace、custom 学习笔记全部内容,希望文章能够帮你解决【IOS 开发学习总结-OC-55】故事板中 segue 的 push、modal、popover、replace、custom 学习笔记所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。