我在这里多次看到这个问题,但没有一个解决方案对我有用。这是我的代码片段:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellClassName = @"DemoTableViewCell_sched";
DemoTableViewCell_sched *cell = [tableView dequeueReusableCellWithIdentifier:CellClassName];
if (cell == nil)
{
NSArray *topLevelItems = [cellLoader instantiateWithOwner:self options:nil];
cell = [topLevelItems objectAtIndex:0];
}
cell.fooData = [self.bugs objectAtIndex:indexPath.row];
return cell;
}
然后我有ViewDidLoad
cellLoader = [UINib nibWithNibName:@"DemoTableViewCell_sched" bundle:[NSBundle mainBundle]];