这就是:我创建了一个包含用于单元格的数据的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:]所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)