Storyboard里面的几种Segue区别和视图的切换

几种segue:push、modal、popover、replace、custom。动画

一。视图切换类型介绍spa

  1.在iPhone和iPad中,segue的类型是不一样的。orm

  2.在iPhone中,segue有(3种):push、modal和custom三种不一样的类型,这些类型的区别在与新页面出现的方式。it

   在iPad中,segue有(5种):push、modal、popover、replace、custom类型。(没用过)io

  3.modal类型(模态转换):form

    a。最经常使用的场景,新的场景彻底盖住了旧的那个。用户没法与上一个场景交互,除非他们先关闭这个场景。方法

    b。它是在viewControllers中的标准切换方式,包括淡出什么的,能够切换动画。di

    c。ModalView:就是会弹出一个view,你只能在该view上操做,而不能切换到其余的view,除非你关闭了modalView。view

    ModalView对应的segue type就是modal segue。storyboard

    当user在弹出的modalView里操做完成后,就应该dismiss the modal view scene而后切换后原视图。

  4.Push类型:

    a。通常须要头一个界面是Navigation Controller的,它是在navigation View Controller中下一级时使用的那种从右侧划入的方式。

    b。该类型是和navigation viewcontrollers一块儿使用。

   5.Popover类型:

    采用浮动窗口的形式把新页面显示出来。

  6.Replace类型:

    替换当期的scene。

   7.Cutom类型:

    自定义跳转方式。

二。ViewController之间的跳转

  1.若是在storyboard中当前的ViewController和要跳转的ViewController之间的segue之间存在,则能够执行performSegueWithIdentifier:sender:这个方法实现跳转。

  好比:[self performSegueWithIdentifier:@"go" sender:self];

     其中,go为本身定义的segue标识符。

  2.若是目标ViewController存在Storyboard中,可是没有segue。你能够经过UIStoryboard的instantiateViewControllerWithIdentifier:这个方法获取到它,而后你再用想要的方式实现跳转,如:压栈。

  3.若是目标ViewController不存在,那就去建立它吧。

相关文章
相关标签/搜索