如何解决NSInternalInconsistencyException?

时间:2012-12-18 07:13:51

标签: iphone ios uitableview ios5 custom-cell

当我尝试在tableView上显示自定义单元格时出现错误。我有一个与单元格连接的nibFile但我总是在这里获得线程sigbart

NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CellForOffers" owner:self options:nil];

我不知道为什么,我的索引实现行的单元格是

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"CellForOffers";
    CellForOffers *cell =(CellForOffers *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {

        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CellForOffers" owner:self options:nil];
        cell = [nib objectAtIndex:0];


        appDC * application = [dataArray objectAtIndex:[indexPath row]];

        cell.namelbl.text=application.o_name;

        cell.descriptionlbl.text=application.o_description;

        [cell.imageView setImageWithURL:[NSURL URLWithString:application.o_image_url]];


    }

    return cell;
}

1 个答案:

答案 0 :(得分:0)

使用类似下面的类添加nib ...

cell = (CellForOffers *)[nib objectAtIndex:0];