2011-12-15 59 views
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设置的值。阵列中有对象可以将它们打印到控制台,但不能打印到单元格中。

+0

此外,如果我用@“Hello World”替换[webRef objectAtIndex:indexPath.row],将单元格值设置为Hello World。并在numberOfRowsInSection中将正确的行设置为数组中的对象数。 – Popeye 2011-12-15 10:49:35

回答

0

我已经解决了这个问题。宣布阵列时我没有保留任何内容。感谢大家提供的帮助。

相关问题