我在Swift 1.2中写了下一篇:

self.pageViewController.setViewControllers(viewControllers as [AnyObject], direction: .Forward, animated: true, completion: nil)

但是现在,在Swift 2中,它会显示下一个错误:
Could not find member 'Forward'

我该如何解决?

最佳答案

您应该确保您的viewControllers不是可选的Type。如:

var viewControllers:[UIViewController] = [VC1,VC2]
self.pageViewController.setViewControllers(viewControllers, direction: UIPageViewControllerNavigationDirection.Forward, animated: true, completion: nil)

关于ios - Swift 2语法错误,方向为.Forward,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32564132/

10-12 01:12