gpt4 book ai didi

ios - PageViewController 不工作

转载 作者:行者123 更新时间:2023-11-28 11:53:52 27 4
gpt4 key购买 nike

我正在集成 PageViewController。我遇到错误。

Could not cast value of type 'UIViewController' (0x105390ca8) to 'VeggieIndia.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
}

enter image description here

最佳答案

问题出在模块中,如果您在身份检查器中查看类名,您会发现模块是 None ,关注类并单击 enter 或选中 Inherit Module From Target

关于ios - PageViewController 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51455807/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com