-2

我搜索了很多但找不到所以这里是我的相关截图:

https://postimg.cc/image/hyrkzet5z/

https://postimg.cc/image/wj8ntpdon/

说:

*** 由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“无法使用标识符单元格使单元格出列 - 必须为标识符注册一个 nib 或一个类或连接故事板中的原型单元格”

在我将 Stack View 插入 Table View 之前,一切都运行良好。我在 Xcode 中有点新。

谢谢你们!

4

1 回答 1

0

当您要求表格视图使单元格出列但找不到该单元格时,会发生此错误。

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'

在您的cellForRowAtIndexPath方法中,表格视图正在尝试将具有标识符的单元格出列cell。如果它是原型单元格,请为您的单元格提供一个标识符。如果您使用的是自定义单元格,请使用viewDidLoad以下代码在表格视图中注册您的单元格。

tableView.register(CustomCell.self, forCellReuseIdentifier: "cell")
于 2018-08-09T20:27:33.270 回答