Swift 2语法错误,方向为.Forward [英] Swift 2 syntax error with direction .Forward
本文介绍了Swift 2语法错误,方向为.Forward的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Swift 1.2中写了下一篇:
I wrote in Swift 1.2 the next:
self.pageViewController.setViewControllers(viewControllers as [AnyObject], direction: .Forward, animated: true, completion: nil)
但是现在,在Swift 2中,它会向我显示下一个错误:
but now, in Swift 2 it prints me the next error:
Could not find member 'Forward'
我该如何解决?
推荐答案
您应确保viewControllers不是可选的Type.如:
You should make sure that your viewControllers not optional Type. Such as:
var viewControllers:[UIViewController] = [VC1,VC2]
self.pageViewController.setViewControllers(viewControllers, direction: UIPageViewControllerNavigationDirection.Forward, animated: true, completion: nil)
这篇关于Swift 2语法错误,方向为.Forward的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文