为什么我的单元格不会显示在表格中的任何想法。它在这段代码处崩溃了...
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"SetTableViewCell";
SetTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil){
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"SetTableViewCell" owner:nil options:nil];
for(id currentObject in topLevelObjects)
{
if([currentObject isKindOfClass:[SetTableViewCell class]])
{
cell = (SetTableViewCell *)currentObject;
break;
}
}
}
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
最佳答案
在这种情况下最常见的事情是忘记将界面生成器中的 UITableViewCell 对象设置为 SetTableViewCell 类
从 Identity Inspector 仔细检查并确保自定义类设置为 SetTableViewCell
关于iphone - UITableViewCell 子类不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9050704/