Ios 自定义ViewController转换,如UIPageViewController

Ios 自定义ViewController转换,如UIPageViewController,ios,animation,transition,uipageviewcontroller,Ios,Animation,Transition,Uipageviewcontroller,如果选择“滚动样式”,我想使用类似于PageViewController中的动画导航tru ViewController。所以我想使用左/右滑动来导航tru。 如何在没有UIPageViewController的情况下执行此操作。 有没有一种方法可以开发可重用类,作为我的应用程序中的主要转换样式 非常感谢您的帮助如果您想要与UIPageViewController相同的效果,您应该直接使用它。这就是它的目的。如果你有不使用它的真正原因,那么你可以在谷歌上搜索许多实现容器视图控制器的教程中的任何一

如果选择“滚动样式”,我想使用类似于PageViewController中的动画导航tru ViewController。所以我想使用左/右滑动来导航tru。 如何在没有UIPageViewController的情况下执行此操作。 有没有一种方法可以开发可重用类,作为我的应用程序中的主要转换样式


非常感谢您的帮助

如果您想要与
UIPageViewController
相同的效果,您应该直接使用它。这就是它的目的。如果你有不使用它的真正原因,那么你可以在谷歌上搜索许多实现容器视图控制器的教程中的任何一个。

好吧,我使用了自定义的故事板片段 代码如下:

自定义序列:

import UIKit
class CustomScrollPagingSegue: UIStoryboardSegue {
override func perform() {
    let firstVCView = self.sourceViewController.view as UIView!
    let secondVCView = self.destinationViewController.view as UIView!
    let screenWidth = UIScreen.mainScreen().bounds.size.width
    let screenHeight = UIScreen.mainScreen().bounds.size.height
    secondVCView.frame = CGRectMake(screenWidth, 0.0, screenWidth, screenHeight)
    let window = UIApplication.sharedApplication().keyWindow
    window?.insertSubview(secondVCView, aboveSubview: firstVCView)
    UIView.animateWithDuration(0.5, animations: { () -> Void in
        firstVCView.frame = CGRectOffset(firstVCView.frame, -screenWidth, 0.0)
        secondVCView.frame = CGRectOffset(secondVCView.frame, -screenWidth, 0.0)
        }) { (Finished) -> Void in
        self.sourceViewController.presentViewController(self.destinationViewController as UIViewController, animated: false, completion: nil)
    }


   }
}
和自定义展开序列

import UIKit

class CustomScrollPagingSegueUnwind: UIStoryboardSegue {
override func perform() {
    // Assign the source and destination views to local variables.
    let secondVCView = self.sourceViewController.view as UIView!
    let firstVCView = self.destinationViewController.view as UIView!

    let screenWidth = UIScreen.mainScreen().bounds.size.width

    let window = UIApplication.sharedApplication().keyWindow
    window?.insertSubview(firstVCView, aboveSubview: secondVCView)

    // Animate the transition.
    UIView.animateWithDuration(0.5, animations: { () -> Void in
        firstVCView.frame = CGRectOffset(firstVCView.frame, screenWidth, 0.0)
        secondVCView.frame = CGRectOffset(secondVCView.frame, screenWidth, 0.0)

        }) { (Finished) -> Void in

            self.sourceViewController.dismissViewControllerAnimated(false, completion: nil)
    }
  }
}
我认为交互转换可以得到100%相同的结果,但我不知道如何实现它们