dimanche 11 janvier 2015

Issue with UIPageViewControllerDataSource using Swift


Vote count:

0




Introduction to the question


The UIPageViewControllerDataSource delegate, according to Apple reference, requires two methods to work.



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


and



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


The code I am using


I have encountered an issue. Here's the code I am using.



func pageViewController(pageViewController: UIPageViewController,
viewControllerBeforeViewController ProView: UIViewController) -> UIViewController? {
...
println("You swiped BACK")

return: nil
}


and



func pageViewController(pageViewController: UIPageViewController,
viewControllerAfterViewController ProView: UIViewController) -> UIViewController? {
...
println("You swiped FORWARD")

return nil
}


The problem



  • I run the simulator

  • I swipe to the right


  • the console's output is


    You swiped BACK You swiped FORWARD




This happens when I swipe to the left too. Why is the console printing both of them and not just one?


Thank you!



asked 27 secs ago







Issue with UIPageViewControllerDataSource using Swift

1 commentaire: