gpt4 book ai didi

ios - 无法转换“[AnyObject ]'to expected argument type ' [UIViewController]”类型的值?

转载 作者:行者123 更新时间:2023-11-29 01:14:45 24 4
gpt4 key购买 nike

private func createPageViewController() {
let pageViewController = self.storyboard?.instantiateViewControllerWithIdentifier("PageViewController") as! UIPageViewController
pageViewController.dataSource = self
pageViewController.delegate = self

if contentImages.count > 0 {
let firstVC = self.getItemController(0)!
let startingVCs: NSArray = [firstVC]
pageViewController.setViewControllers(startingVCs as [AnyObject] as [AnyObject], direction: .Forward, animated: false, completion: nil)
}

最佳答案

改变这个

pageViewController.setViewControllers(startingVCs as [AnyObject] as [AnyObject], direction: .Forward, animated: false, completion: nil)

进入

viewControllers 参数现在是 [UIViewController]。因此,您传入的 viewControllers 数组必须是 [UIViewController]

pageViewController.setViewControllers(startingVCs as [UIViewController], direction: .Forward, animated: false, completion: nil)

关于ios - 无法转换“[AnyObject ]'to expected argument type ' [UIViewController]”类型的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35343010/

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