首页 > 代码库 > TableView报错 failed to obtain a cell from its dataSource

TableView报错 failed to obtain a cell from its dataSource

检查原因1:是否已经注册cell

<style>p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #3495af } span.s1 { color: #000000 } span.s2 { color: #0433ff } span.s3 { } span.s4 { color: #b4261a }</style>

    [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