当我构建代码时,它很好。但运行后,我有2个错误:
Thread 1: signal SIGABRT
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
我猜您使用不同的标识符或未在storyboard中配置的单元格作为customTableViewCell