Closed CoderYLZhang closed 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]]; }
我也遇到了这个问题
iOS 10.3 莫名其妙的就会出现这个问题
出这种问题,可能是先设置了tableview的其它属性,比如先设置tableHeaderView、delegate、datasource,后注册cell。解决办法就是先注册cell,再设置tableview的其它属性。
same as #119
高度方法里 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]]; }