【问题标题】:Editor placeholder in source file tableview.dequeueReusableCell源文件 tableview.dequeueReusableCell 中的编辑器占位符
【发布时间】:2017-04-29 02:14:34
【问题描述】:

不断收到此错误:

'源文件中的编辑器占位符'

在线tableView.dequeueReusableCell,不知道出了什么问题。请帮助如何摆脱这个错误。函数原型由 Xcode 建议。无法像某些人建议的那样删除tableView.dequeueReusableCell 中的withIdentifier 以解决此问题。

func tableView(_ tableView:UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "BasicCell", for: IndexPath)
    cell.textLabel?.text = filters[indexPath.row]

    return cell
}

【问题讨论】:

  • indexPath(小写)。
  • IndexPath 在函数调用中仍然使用占位符值(注意背景突出显示)。您需要将其替换为indexPath

标签: swift xcode


【解决方案1】:

看看错误在哪里。它位于for: 之后的IndexPath 部分。

您必须将该占位符替换为有效的 IndexPath 引用,例如 indexPath 参数。

【讨论】:

    猜你喜欢
    • 2020-02-22
    • 2017-05-04
    • 2016-09-18
    • 2019-04-30
    • 1970-01-01
    相关资源
    最近更新 更多