预期{在函数声明中|斯威夫特| Xcode 7.2.1

时间:2016-02-23 16:46:40

标签: ios xcode swift uipageviewcontroller

实施后

func pageViewController(pageViewController: UIPageViewController, viewControllerBeforeViewController viewController: UIViewController) -> UIViewController?


func pageViewController(pageViewController: UIPageViewController, viewControllerAfterViewController viewController: UIViewController) -> UIViewController?

Xcode告诉我这个错误:

  

预期' {'在函数声明体中

http://i.stack.imgur.com/315n9.png

我希望你们能帮助我

1 个答案:

答案 0 :(得分:1)

这两个函数都需要一个后面的闭包,返回一个UIViewController?您只需要包含以下内容:

func pageViewController(pageViewController: UIPageViewController, viewControllerBeforeViewController viewController: UIViewController) -> UIViewController? {

return //name of your viewController
}

func pageViewController(pageViewController: UIPageViewController, viewControllerAfterViewController viewController: UIViewController) -> UIViewController? {

return //name of your viewController

}