0
任何人都可以帮助我想设置表格视图中的单元格的值,但我得到EXC_BAD_ACCESS。这里是我的代码:无法从NSMutableArray设置UITableView中的单元格获取EXC_BAD_ACCESS
- (UITableViewCell *)tableView:(UITableView *) tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView depueueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
cell.textLabel.text = [webRef objectAtIndec:indexPath.row];
return cell;
}
我试图从一个NSMutableArray设置的值。阵列中有对象可以将它们打印到控制台,但不能打印到单元格中。
此外,如果我用@“Hello World”替换[webRef objectAtIndex:indexPath.row],将单元格值设置为Hello World。并在numberOfRowsInSection中将正确的行设置为数组中的对象数。 – Popeye 2011-12-15 10:49:35