forkingdog / UITableView-FDTemplateLayoutCell

Template auto layout cell for automatically UITableViewCell height calculating
MIT License
9.94k stars 2.01k forks source link

cell 已经注册了,但是还是在断言那里crash,怎么回事 #284

Closed CoderYLZhang closed 7 years ago

CoderYLZhang commented 7 years ago
        // 注册
        [self.tableview registerClass:[NewsDetailContentCell class] forCellReuseIdentifier:@"NewsDetailContentCell"];

高度方法里 return [tableView fd_heightForCellWithIdentifier:@"NewsDetailContentCell" configuration:^(NewsDetailContentCell * cell) { [cell rf_updateWithContrentString:_newsModel.content]; }];

crash在这里 if (!templateCell) { templateCell = [self dequeueReusableCellWithIdentifier:identifier]; NSAssert(templateCell != nil, @"Cell must be registered to table view for identifier - %@", identifier); templateCell.fd_isTemplateLayoutCell = YES; templateCell.contentView.translatesAutoresizingMaskIntoConstraints = NO; templateCellsByIdentifiers[identifier] = templateCell; [self fd_debugLog:[NSString stringWithFormat:@"layout cell created - %@", identifier]]; }

xyxdasnjss commented 7 years ago

我也遇到了这个问题

Antduo commented 7 years ago

iOS 10.3 莫名其妙的就会出现这个问题

Daniate commented 7 years ago

出这种问题,可能是先设置了tableview的其它属性,比如先设置tableHeaderView、delegate、datasource,后注册cell。解决办法就是先注册cell,再设置tableview的其它属性。

weekwood commented 7 years ago

same as #119