cellForRowAtIndexPath中非常奇怪的问题

时间:2012-01-13 00:31:21

标签: ios uitableview exc-bad-access

我真的不明白为什么我在分配NSArray *topLevelObjects的行中得到“EXC_BAD_ACCESS”。这很疯狂,因为我在另一个tabliView中使用完全相同的代码和相同的BlogCell,并且它在那里工作得很好!

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    int r = indexPath.row;
    static NSString *CellIdentifier = @"Blog";
    BlogCell *cell = (BlogCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {

        NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"BlogCell" owner:self options:nil];
        cell = [topLevelObjects objectAtIndex:0];  
    }        

    return cell;
}

1 个答案:

答案 0 :(得分:0)

确保您在BlogCell中指定给FilesOwner的所有出口在此课程中都有相应的IBOutlets。