Создание tableView
по storyboard
, и в методе tableView delegate
: tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
происходит исключение:Создание Tableview по раскадровке использовать пользовательские tableViewCell образуют XIB получить отказ Assertion
*** Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:],
/BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3599.6/UITableView.m:6593
мой код находится ниже:
ViewController11
@IBOutlet weak var tableView: UITableView! // tableView
// tableview delegate
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell_id: String = "cell_id"
// this line below occurs exception: Thread 1:breakpoint 5.2
var cell: TableViewCell2 = tableView.dequeueReusableCell(withIdentifier: cell_id, for: indexPath) as! TableViewCell2
if cell == nil {
//
}
var title = dataSource[indexPath.row]
cell.titlelabel?.text = String(title)
return cell
}
и мой storyboard
для ViewController11
:
и мой xib
для TableViewCell2
:
увидеть этот раз http://stackoverflow.com/questions/12737860/assertion-failure-in-dequeuereusablecellwithidentifierforindexpath –
перед тем извлечение из ячейки вам необходимо зарегистрировать его '' class' или nib' с помощью 'tableView'. – Adeel