【发布时间】:2012-03-04 03:26:30
【问题描述】:
我在使用 Instruments 时一直在设备 (iOS 5) 上测试该应用程序,但我发现了一些内存泄漏。
这是我从 Instruments 重定向到的代码部分(请参阅箭头以了解确切的行):
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
CeldaUltimasFotosViewCell *cell =
(CeldaUltimasFotosViewCell *) [self.tableView
dequeueReusableCellWithIdentifier:@"CeldaUltimasFotosViewCell"];
if (cell == nil) {
- - - - > NSArray *topLevelObjects =
[[NSBundle mainBundle]
loadNibNamed:@"CeldaUltimasFotosViewCell"
owner:nil options:nil];
cell = [topLevelObjects objectAtIndex:0];
}
// Configure the cell...
[[cell titulo] setFont:fuente_titulo];
...
return cell;
}
如您所见,我有一个从 NIB 文件加载的自定义单元格。单元格有三个文件(customCell.m、customCell.h、customCell.xib)。问题是我不知道我是否必须在单元控制器中释放某些东西(现在是空的,没有方法),因为这是带有 ARC 的 iOS 5。
【问题讨论】:
标签: ios memory-leaks uitableview automatic-ref-counting