【发布时间】:2011-07-21 19:35:09
【问题描述】:
-(void)setIT:(customOfferCell *)curr {
NSAutoreleasePool *imagePool = [ [ NSAutoreleasePool alloc ] init ];
NSURL *url = [[NSURL URLWithString:imageURL]autorelease];
NSData *imageData = [[NSData dataWithContentsOfURL:url] autorelease];
curr.offerImage.image = [[UIImage imageWithData:imageData]autorelease];
[imagePool drain];
}
您好,我遇到了标题错误并且程序运行良好,但是泄漏的数量与我有关,我调查了导致它的原因,因为此方法是在新线程上调用的:
[NSThread detachNewThreadSelector: @selector(setIT:) toTarget:self withObject:cell];
我需要创建一个自动释放池并自动释放对象。调用上述方法将图像加载到我的自定义 UITableViewCell 上。当我运行它时,我会在甚至没有运行的委托上遇到奇怪的错误。有人可以帮忙吗?
谢谢!
【问题讨论】:
标签: iphone objective-c xcode4 autorelease