我有这个代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"BSTGListCell";
BSTGListCell *cell = (BSTGListCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
cell = [[[NSBundle mainBundle] loadNibNamed:@"BSTGListCell" owner:self options:nil] objectAtIndex:0];
}
PFObject* currentEl = [self.tableData objectAtIndex:indexPath.row];
cell.title.text = [currentEl objectForKey:@"Name"];
cell.description.text = [currentEl objectForKey:@"Address"];
return cell;
}
向下滚动作为子视图添加的表视图时,我收到“发送到已释放实例的消息”。Zombie inspector 说被访问的对象被保留在这里:
cell = [[[NSBundle mainBundle] loadNibNamed:@"BSTGListCell" owner:self options:nil] objectAtIndex:0];
并且可能由 ARC 发布。为什么会发生这种情况,我该如何预防?