#swift #uitableview
#swift #uitableview
Вопрос:
Когда я собираю код, все в порядке. Но после запуска у меня есть 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 }
Debug показывает ошибку в:
пусть cell = TableView.dequeueReusableCell(с идентификатором: «cellIdentifier», для: indexPath как indexPath) как! customTableViewCell
Комментарии:
1. В Interface Builder класс пользовательской ячейки не установлен в
customTableViewCell
. Кстати, имена классов должны начинаться с заглавной буквы.2. Я нашел. Я допустил ошибку в имени idenfirier
Ответ №1:
Я предполагаю, что вы используете другой идентификатор или ячейку, не настроенную в раскадровке, как customTableViewCell