当TransitionStyle更改为.Scroll时,应用程序崩溃

时间:2015-03-24 18:47:24

标签: swift uipageviewcontroller

我正在尝试将transitionStyle的PageViewControllers从.PageCurl更改为.Scroll。该应用当前正常使用.PageCurl,但在您尝试从.Scroll向右滑动时设置为MenuViewController时会在运行时崩溃。

从设置RootViewController.swift的{​​{1}}开始:

transitionStyle

我得到的错误是" 0 swift_dynamicClassUnconditional"。我错误指出的断点位于self.pageViewController = UIPageViewController(transitionStyle: .PageCurl, navigationOrientation: .Horizontal, options: nil) self.pageViewController!.delegate = self let startingViewController = storyboard!.instantiateViewControllerWithIdentifier("MenuViewController") as UIViewController

ModelController.swift

根据Xcode的错误的具体行是

func pageViewController(pageViewController: UIPageViewController, viewControllerBeforeViewController viewController: UIViewController) -> UIViewController? {

    if fromMenu == true {
        var index = self.indexOfViewController(viewController as DataViewController)
        if (index == NSNotFound) {
            return nil
        }
        if (index == 0) {
            index = experiments.count - 1
        }

        index--
        return self.viewControllerAtIndex(index, storyboard: viewController.storyboard!)
    } else {
        println("fromMenu is \(fromMenu)")
        fromMenu = true
        return self.viewControllerAtIndex(0, storyboard: viewController.storyboard!)
    }
}

我是否需要进行其他更改才能使用var index = self.indexOfViewController(viewController as DataViewController)

0 个答案:

没有答案