我在storyboard中使用正确的重用ID创建了两个原型。调试器在我的自定义单元格内的各个断点处停止,但表视图仍然显示空白单元格。是什么给了什么?
提前致谢
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellID = @"CellIdentifier";
static NSString *CommentCellID = @"CommentCellIdentifier";
// for iOS6+ not specifying forIndexPath:indexPath causes assertion when endUpdates is called
NSUInteger sectionNumber = [indexPath section];
switch (sectionNumber) {
case 2: {
// Try to dequeue a cell and create one if necessary
SDCCommentCell *commentCell = [tableView dequeueReusableCellWithIdentifier:CommentCellID];
if (commentCell == nil) {
commentCell = [[SDCCommentCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CommentCellID];
//cell.cellInsetWidth = kSDCCellInsetWidth;
commentCell.delegate = self;
}
PFObject *object = [parseObjectsArray objectAtIndex:indexPath.row];
[commentCell setUser:[object objectForKey:kSDCActivityFromUserKey]];
[commentCell setContentText:[object objectForKey:kSDCActivityContentKey]];
[commentCell setDate:[object createdAt]];
return commentCell;
}
default: {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID forIndexPath:indexPath];
return cell;
}
}
}
答案 0 :(得分:0)
没关系..我只是想通了。我忘了添加viewDidLoad()
[self.tableView registerClass:[SDCCommentCell class] forCellReuseIdentifier:@"CommentCellIdentifier"];