當一個tableview加載不同的cell荸百,且cell是xib類型時税迷,需要以下方法夯辖,解決重用cell報錯問題:
```
static NSString *CellIdentifier = @"Cell";
BOOL nibsRegistered = NO;
if ( !nibsRegistered ) {
UINib *nib = [UINib nibWithNibName:NSStringFromClass([Cell class]) bundle:nil];
[tableView registerNib:nib forCellReuseIdentifier:CellIdentifier];
nibsRegistered=YES;
}
Cell*cell = (Cell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.titleLabel.text=[self.dataList objectAtIndex:indexPath.row];
return cell;
```