简体   繁体   English

使用tableview函数时出现错误

[英]getting the error when using tableview function

The program is building successfully, but when it goes into the simulation, it crashes, and the fatal error message is logged to console. 该程序正在成功构建,但是当进入仿真时,它将崩溃,并将致命错误消息记录到控制台。

The line that triggers the error is: 触发错误的行是:

let cell = self.tableview?.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! CustomCell

在此处输入图片说明

Is cell returning nil? 细胞返回零吗? You need to make sure that you're passing the correct identifier of the UITableViewCell in your storyboard to the withIdentifier: "cell" parameter. 您需要确保将情节withIdentifier: "cell"中的UITableViewCell的正确标识符传递给withIdentifier: "cell"参数。 Also, what is being logged to the console when you get this error? 另外,出现此错误时正在向控制台记录什么? Many times it will point to the solution. 很多时候它将指向解决方案。

在情节提要中提供相同的标识符“单元格”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM