private func createPageViewController() {
let pageViewController = self.storyboard?.instantiateViewControllerWithIdentifier("PageViewController") as! UIPageViewController
pageViewController.dataSource = self
pageViewController.delegate = self
if contentImages.count > 0 {
let firstVC = self.getItemController(0)!
let startingVCs: NSArray = [firstVC]
pageViewController.setViewControllers(startingVCs as [AnyObject] as [AnyObject], direction: .Forward, animated: false, completion: nil)
}
答案 0 :(得分:1)
更改此
pageViewController.setViewControllers(startingVCs as [AnyObject] as [AnyObject], direction: .Forward, animated: false, completion: nil)
进入
viewControllers
参数现在是[UIViewController]
。因此,您传入的viewControllers
数组必须为[UIViewController]
。
pageViewController.setViewControllers(startingVCs as [UIViewController], direction: .Forward, animated: false, completion: nil)