ios – Swift – 断言失败 – [UITableView _configureCellForDisplay:forIndexPath:]

ios – Swift – 断言失败 – [UITableView _configureCellForDisplay:forIndexPath:],第1张

概述我在tableView之后得到错误(tableView:UITableView,cellForRowAtIndexPath indexPath:NSIndexPath) – > UITableViewCell运行了几次. 这就是:我创建了一个包含用于单元格的数据的teacherArray,它肯定包含了我需要的内容. 我使用故事板来定制单元格和tableview.我已经检查了单元格的标识符是否已设置 我在tableVIEw之后得到错误(tableVIEw:UItableVIEw,cellForRowAtIndexPath indexPath:NSIndexPath) – > UItableVIEwCell运行了几次.
这就是:我创建了一个包含用于单元格的数据的teacherArray,它肯定包含了我需要的内容.
我使用故事板来定制单元格和tablevIEw.我已经检查了单元格的标识符是否已设置,我还为表格视图和标识检查器中的单元格定制了类.

overrIDe func numberOfSectionsIntableVIEw(tableVIEw: UItableVIEw) -> Int {    return 1}overrIDe func tableVIEw(tableVIEw: UItableVIEw,numberOfRowsInSection section: Int) -> Int {    return teacherArray.count}overrIDe func tableVIEw(tableVIEw: UItableVIEw,cellForRowAtIndexPath indexPath: NSIndexPath) -> UItableVIEwCell {    let cell = self.tableVIEw.dequeueReusableCellWithIDentifIEr("SearchCell",forIndexPath:indexPath) as SearchCell    cell.nameLabel.text = teacherArray[indexPath.row].name    cell.schoolLabel.text = teacherArray[indexPath.row].school    cell.experIEnceLabel.text = teacherArray[indexPath.row].experIEnce    cell.courseLabel.text = teacherArray[indexPath.row].course    println(indexPath.row)    println(cell)    return cell}

我已经跟踪了这个方法,它是在这个控制台输出之后:

6PAL.SearchCell: 0x7bf32310; baseClass = UItableVIEwCell; frame = (0 450; 320 75); autoresize = W; layer = <CALayer: 0x7bf322e0>

…我收到此错误消息:

2015-04-26 22:27:54.880 PAL[65213:6357947]*** Assertion failure in -[UItableVIEw _configureCellFordisplay:forIndexPath:],/SourceCache/UIKit_Sim/UIKit-3318.93/UItableVIEw.m:7344   *** Terminating app due to uncaught exception 'NSInternalinconsistencyException',reason: 'UItableVIEw dataSource must return a cell from tableVIEw:cellForRowAtIndexPath:'

我不知道我做错了什么.任何的想法?

解决方法 试试这个:

add UItableVIEwDataSource,UItableVIEwDelegate:class HDMainHotBoleCtr: UIVIEwController,UItableVIEwDataSource,UItableVIEwDelegate {    }
总结

以上是内存溢出为你收集整理的ios – Swift – 断言失败 – [UITableView _configureCellForDisplay:forIndexPath:]全部内容,希望文章能够帮你解决ios – Swift – 断言失败 – [UITableView _configureCellForDisplay:forIndexPath:]所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1014199.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存