UITableViewCell子类显示为空
我用正确的重用ID在故事板中创建了两个原型。调试器在自定义单元格内的各个断点处停止,但表视图仍显示空白单元格。有什么好处 提前谢谢UITableViewCell子类显示为空,uitableview,cell,subclass,Uitableview,Cell,Subclass,我用正确的重用ID在故事板中创建了两个原型。调试器在自定义单元格内的各个断点处停止,但表视图仍显示空白单元格。有什么好处 提前谢谢 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellID = @"CellIdentifier"; static NSString *CommentCellID =
- (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;
}
}
}没关系。。我刚想出来。我忘了添加
viewDidLoad()
[self.tableView registerClass:[SDCCommentCell class] forCellReuseIdentifier:@"CommentCellIdentifier"];