我得到這個錯誤時,我的「其他」塊運行的第一行:Swift3 - 搜索崩潰表的第一個字母查看
無法出列與indentifier PhoneCell細胞 - 必須註冊筆尖或類的標識符或連接故事板中的原型單元格
因此,初始表加載正常,但是當您嘗試執行搜索時引發此異常。這只是在我去一個自定義單元后纔開始發生的。以下是正在崩潰的表的cellForRowAtIndexPath函數。任何想法發生了什麼?
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if tableView == self.tableView{
let cell = self.tableView.dequeueReusableCell(withIdentifier: "PhoneCell", for: indexPath) as! PhoneSearchResultTableViewCell
cell.nameLabel.text = phones[indexPath.row].name.value
cell.descriptionLabel.text = phones[indexPath.row].descriptionText.value
cell.modelLabel.text = phones[indexPath.row].model.value
return cell
}else{
let cell = self.resultsController.tableView.dequeueReusableCell(withIdentifier: "PhoneCell", for: indexPath) as! PhoneSearchResultTableViewCell
cell.nameLabel.text = filteredPhones[indexPath.row].name.value
cell.descriptionLabel.text = filteredPhones[indexPath.row].descriptionText.value
cell.modelLabel.text = filteredPhones[indexPath.row].model.value
return cell
}
}
你註冊的resultsController表視圖‘PhoneCell’標識? –