gpt4 book ai didi

ios - 调用中的参数标签不正确(有 'frame:' ,预期为 'coder:' )

转载 作者:搜寻专家 更新时间:2023-11-01 06:01:03 25 4
gpt4 key购买 nike

它在 UIView 中工作但在 ViewController 中不工作,我收到此错误“调用中的参数标签不正确(有'frame:',预期'coder:')”,如何解决这个问题。请查看附件图片

enter image description here

 init(frame: CGRect) {
super.init(frame: frame)
self.view.backgroundColor=UIColor.clear

currentMonthIndex = Calendar.current.component(.month, from: Date()) - 1
currentYear = Calendar.current.component(.year, from: Date())
setupViews()
btnLeft.isEnabled=true
}

super.init(frame: frame) 我收到这一行的错误

最佳答案

UIViewController 不包含框架初始化它仅用于 UIView 元素

let myViewController = MyViewController( )

let myViewController = MyViewController(nibName: "MyViewController", bundle: nil)

//

class myViewController:UIViewController {

// put here the properties

override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor=UIColor.clear
currentMonthIndex = Calendar.current.component(.month, from: Date()) - 1
currentYear = Calendar.current.component(.year, from: Date())
setupViews()
btnLeft.isEnabled=true
}
}

关于ios - 调用中的参数标签不正确(有 'frame:' ,预期为 'coder:' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50643973/

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