【发布时间】:2009-03-05 15:49:29
【问题描述】:
我有一个显示 UICachedDeviceWhiteColor 的内存泄漏。我没有在任何地方使用 UICachedDeviceWhiteColor 并且搜索它发现人们说这是 iPhone-SDK 中的错误。我发现了这个博客条目: http://piezoelectrics.blogspot.com/2009/02/uicacheddevicewhitecolor-leak-in-iphone.html
但我找不到
#import "NSAutoreleasePool.h"
我收到“错误:NSAutoReleasePool.h:没有这样的文件或目录”。是否有解决此内存泄漏或从 nib 分配表格单元格的正确方法?
这是我目前的做法:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = nil;
cell = [tableView dequeueReusableCellWithIdentifier:@"CellNameIdentifier"];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"CellName" owner:self options:nil];
//cellName is IBOutlet to XIB's tablecell. I reference it several times in this calss
cell = cellName;
}
return cell;
}
我在这里没有看到分配器,为什么会有内存泄漏?这可能是个问题吗:
@property (nonatomic, retain) IBOutlet UITableViewCell *cellName;
【问题讨论】:
标签: objective-c iphone cocoa-touch uitableview