编译器我的项目UITableViewCell有问题

问题描述 投票:-1回答:1

当我构建代码时,它很好。但运行后,我有2个错误:

  1. Thread 1: signal SIGABRT
  2. Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "CellIdentifier", for: indexPath as IndexPath) as! customTableViewCell cell.transAmount?.text = "cell number \(indexPath.row)." cell.transDate?.text = "cell number \(indexPath.row)." return cell }

调试显示错误:

let cell = tableView.dequeueReusableCell(withIdentifier:“CellIdentifier”,for:indexPath as IndexPath)as! customTableViewCell

swift uitableview
1个回答
0
投票

我猜您使用不同的标识符或未在storyboard中配置的单元格作为customTableViewCell

© www.soinside.com 2019 - 2024. All rights reserved.