gpt4 book ai didi

ios - 无法执行方法--错误 :Value of type 'UITableViewCell' has no member 'getCell'

转载 作者:行者123 更新时间:2023-11-28 05:52:24 39 4
gpt4 key购买 nike

我正在尝试在单元格方法中调用函数,但在此之前我需要在 View Controller 单元格中调用函数。每次我尝试调用 Xcode 时都无法识别它并出现错误。如果我只是复制它(“UITableViewCell”类型的值没有成员“getCell”)。

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell:TableViewCell1 = tableViewFullP1.dequeueReusableCell(withIdentifier: "cell01", for: indexPath) as! TableViewCell1

configureCell(cell, at: indexPath) // The one I want to call in the end

return cell
}

//Fetch Method P1
func fetchInfoToHomepage() {
let fetchRequest88: NSFetchRequest<Information> = Information.fetchRequest()
let sortOnDate = NSSortDescriptor(key: "date_info9", ascending: false)

fetchRequest88.sortDescriptors = [sortOnDate]

controllerItch = NSFetchedResultsController(fetchRequest: fetchRequest88, managedObjectContext: context77, sectionNameKeyPath: nil, cacheName: nil)
controllerItch.delegate = self

do {
try controllerItch.performFetch()
} catch {print("Failed fetch p1")}
}

// Sepcical func
func configureCell(_ cell: UITableViewCell, at indexPath: IndexPath) {
var malekHosny = controllerItch.object(at: indexPath)
cell.getCell(infos: malekHosny) //Here's the problem
}

最佳答案

大概您的 UITableViewCell 子类确实有一个getCell 方法。所以你需要转换到那个子类:

(cell as! TableViewCell1).getCell...

关于ios - 无法执行方法--错误 :Value of type 'UITableViewCell' has no member 'getCell' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52449732/

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