Tyl*_*ler 0 ios uipageviewcontroller swift
我有一个UIPageViewController,它正在翻阅页面,所有页面都正确加载,除了它保持黑色的第一页,加载图标也不会消失.以下是我的方法用于设置pageviewcontroller的第一个视图(它是对从后端获取信息的函数的回调)
self.card.images = cardImagesArray
activityIndicator.stopAnimating()
activityIndicator.removeFromSuperview()
self.cardImages = cardImagesArray
let startingViewController: UIViewController = getItemController(0)!
let viewControllers: NSArray = [startingViewController]
pageViewController!.setViewControllers(viewControllers as! [AnyObject], direction: .Forward, animated: false, completion: nil)
Run Code Online (Sandbox Code Playgroud)
对于那些有同样问题的人(比如我),一直在寻找最后几个小时但仍然无法弄清楚出了什么问题,这是我犯下的愚蠢错误造成了这个问题:原来我的viewController是UIPageViewController的一个实例,而不是UIViewController.