我正在积分PageViewController
。我有个错误。
无法将“UIViewController”(0x105390ca8)类型的值强制转换为“veggieinda.PageContentViewController”(0x10273bc98)。
override func viewDidLoad() {
super.viewDidLoad()
arrPagePhoto = ["background", "background", "3.jpg"];
self.setViewControllers([getViewControllerAtIndex(index: 0)], direction: .forward, animated: true) { (true) in
}
self.dataSource = self
// self.setViewControllers([getViewControllerAtIndex[0]] as [UIViewController], direction: UIPageViewControllerNavigationDirection.Forward, animated: false, completion: nil)
// Do any additional setup after loading the view, typically from a nib.
}
func getViewControllerAtIndex(index: NSInteger) -> PageContentViewController {
// Create a new view controller and pass suitable data.
let pageContentViewController = self.storyboard?.instantiateViewController(withIdentifier: "PageContentViewController") as! PageContentViewController
pageContentViewController.strPhotoName = "\(arrPagePhoto[index])"
pageContentViewController.pageIndex = index
return pageContentViewController
}
最佳答案
问题是在模块中如果您在identity inspector中查看类名,就会发现module is None,关注类并单击enter或checkInherit Module From Target
关于ios - PageViewController不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51455807/