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