当滚动tableview时,我收到EXC_BadAccess错误消息。滚动tableview时获取EXC_Bad_Access
以下是我在cellForRowAtIndexPath中完成的代码。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *[email protected]"customCellHistory";
customCellHistory *cell=(customCellHistory*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *topLevelObjects=[[NSBundle mainBundle]loadNibNamed:@"customCellHistory" owner:self options:nil];
for (id currentObject in topLevelObjects) {
if ([currentObject isKindOfClass:[UITableViewCell class]]) {
cell=(customCellHistory*)currentObject;
break;
}
}
}
cell.lb11.text=[cellArray1 objectAtIndex:indexpath.row];
cell.lbl2.text=[cellArray2 objectAtIndex:indexpath.row];
return cell;
}
我能感觉到问题是由于上面的代码中的一些错误而引起的。
我在上面的代码中使用了CustomCell来显示自定义的单元格。
谁能告诉我,我是用这个代码
嗨,我收到错误“[__NSArrayI objectAtIndex:]:发送到释放实例的消息”。 – surendher 2013-05-09 10:24:57
你什么时候得到这个错误? – icodebuster 2013-05-09 11:58:32
您是否创建了自定义单元格NIB并将其cellIdentifier设置为'customCellHistory' – icodebuster 2013-05-09 12:02:03