TableView报错 failed to obtain a cell from its dataSource
Posted justqi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了TableView报错 failed to obtain a cell from its dataSource相关的知识,希望对你有一定的参考价值。
检查原因1:是否已经注册cell
[self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([SendTeachNotiTableViewCell class]) bundle:nil] forCellReuseIdentifier:@"teachersend"];
检查原因2:cellForRowAtIndexPath 方法中cell是否为空 可能cell调用早了,导致cell为nil时无法赋值
if(cell==nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifierdata]
}
以上是关于TableView报错 failed to obtain a cell from its dataSource的主要内容,如果未能解决你的问题,请参考以下文章