gpt4 book ai didi

ios - 我面临这个错误 "this class is not key value coding-compliant for the key tableView"。我在这里做错了什么?

转载 作者:搜寻专家 更新时间:2023-11-01 05:47:34 24 4
gpt4 key购买 nike

<分区>

因此,这是一个多页面应用程序,每当我切换到其中存在 UITable 的页面时,我都会遇到此错误“setValue:forUndefinedKey:]: 此类与键 tableView 的键值编码不兼容。”我之前遇到了同样的错误,因为我忘记添加 numberOfRowsInSection 函数,但即使在添加之后我仍然面临同样的错误。

class workingQuery: UIViewController, UITableViewDelegate, UITableViewDataSource{


@IBOutlet weak var tableViews: UITableView!


override func viewDidLoad() {
super.viewDidLoad()
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated
}


//TableView Code
var names = ["Mark", "Cloyd", "Buck", "Steve", "Wallace"]
var breeds = ["Labrador Retriver", "Bulldog", "German Shepherd", "Golden Retriver", "Yorkshire"]
var images = [UIImage(named:"johnny"), UIImage(named:"dusra"), UIImage(named:"Third"), UIImage(named:"Fourth"), UIImage(named:"Fifth")]

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 5

}

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = self.tableViews.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! CustomCell

cell.photo.image = images[indexPath.row]
cell.fullName.text = names[indexPath.row]
cell.ageSex.text = breeds[indexPath.row]
return cell

}
}

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