2016-02-11 171 views
0
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

請與'pageViewController.setViewControllers(startingVCs爲[UIViewController中],方向:的.forward,動畫:假的,完成:無)' –

回答

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) 
+0

非常感謝你 –

+0

@ShreyasPapinwar - 歡迎我的兄弟 –

相關問題