关于网友提出的“得到NSInternalInconsistencyException”问题疑问,本网通过在网上对“得到NSInternalInconsistencyException”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题:得到NSInternalInconsistencyException
描述:开发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;
}
解决方案1:在类中添加nib就可以了:
cell = (CellForOffers *)[nib objectAtIndex:0];
解决方案2:应该是你的自定义Cell把View作为最外面了,要把TableVIewCell拖过去应该就对 了
以上介绍了“得到NSInternalInconsistencyException”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/wd/692892.html