gpt4 book ai didi

ios - 使用纸质入职时出错

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

我一直在关注 Youtube 上的这个教程:https://www.youtube.com/watch?v=G5UkS4Mrepo但我在返回时不断收到以下错误并且找不到解决方案:

Cannot convert return expression of type '(String, String, String, String, UIColor, UIColor, UIColor, UIFont, UIFont)' to return type 'OnboardingItemInfo' (aka '(imageName: UiImage, title: String, description: String, iconName: UiImage, color: UIColor, titleColor: UIColor, descriptionColor: UIColor, titleFont: UIFont, descriptionFont: UIFont)')

在 15:13 分钟左右,他根据他提供的代码展示了一个正常运行的应用程序,但我的应用程序却抛出错误。这是我的代码:

...

@IBOutlet weak var onboardingView: OnboardingView!

override func viewDidLoad() {
super.viewDidLoad()
onboardingView.dataSource = self
}

func onboardingItemsCount() -> Int {
return 3
}

func onboardingItemAtIndex(_ index: Int) -> OnboardingItemInfo {
let backgroundColorOne = UIColor(red: 217/255, green: 72/255, blue: 89/255, alpha: 1)
let backgroundColorTwo = UIColor(red: 106/255, green: 166/255, blue: 211/255, alpha: 1)
let backgroundColorThree = UIColor(red: 168/255, green: 200/255, blue: 78/255, alpha: 1)

return[
("rocket", "a great rocket start", "text description", "", backgroundColorOne, UIColor.white, UIColor.white, titleFont, descriptionFont)
][index]
}

...

文档可在此处找到:https://cdn.rawgit.com/Ramotion/paper-onboarding/master/docs/index.html

最佳答案

根据错误消息,返回的元组中的第 1 个和第 4 个值需要属于 UIImage 类型,而不是 String。设计此 API 的人在这两个值的命名约定方面做得很差。

另请注意,您已指定有 3 个项目,但您的 onboardingItemAtIndex 只有一个值数组。

关于ios - 使用纸质入职时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44998988/

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