開發ios應用中,在tableView顯示自定義單元的時候出現錯誤,我是用nibFile連接cell,
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CellForOffers" owner:self options:nil];
cell實現:
- (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;
}
應該是你的自定義Cell把View作為最外面了,要把TableVIewCell拖過去應該就對 了