gpt4 book ai didi

ios - Xcode (Swift) 错误 - 使用未声明的类型 'CustomCell'

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

我一直在通过 YouTube 上的教程学习表格 View 。我按照视频中的每一步进行操作,并按照本教程的作者所做的一切,但出于某种原因,我遇到了一个奇怪的错误 - 我听说这是关于本教程中使用的旧版本 Xcode - 我'我正在研究最新的一个。

调试器告知“CustomCell”未声明。

我们将不胜感激!

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arrayOfCwiczenia.count

}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: CustomCell = tableView.dequeueReusableCellWithIdentifier("Cell") as CustomCell


let person = arrayOfCwiczenia[indexPath.row]
cell.setCell(cwiczenia.nazwa, imageName: cwiczenia.obrazek)
return cell


}

最佳答案

CustomCell 看起来是 UITableViewCell 的子类

看起来他们遗漏了您需要创建它的部分

创建一个名为 CustomCell 的新文件并确保它的基类是 UITableViewCell

关于ios - Xcode (Swift) 错误 - 使用未声明的类型 'CustomCell',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34615036/

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