我有这个代码:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: IndexPath) as? Cell
但是 IndexPath 显示错误:
最佳答案
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: IndexPath) as? Cell
在这一行中,您将传递 IndexPath
类而不是函数中的 indexPath
参数。将其替换为:
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? Cell
关于swift - 在 Swift 3 中使用 UITableView 和 IndexPath 显示错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39500795/