我正在尝试将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)
?