滚动UIImageViews获得“低内存警告”

时间:2012-04-30 18:48:56

标签: memory-leaks uiscrollview uiimageview uiimage

我的应用程序相对简单 - 基本上是UIScrollView来查看几百个(大)JPEG。然而,它与“低内存警告”一致地崩溃

滚动视图包含三个UIImageView s(previousPagecurrentPagenextPage)。在开始时,每次滚动当前页面时,我都会使用新的UIImageView“重置”三个UIImages

NSString *previousPath = [[NSBundle mainBundle] pathForResource:previousName ofType:@"jpg"];
previousPage.image = [UIImage imageWithContentsOfFile:previousPath];
currentPage.image = [UIImage imageWithContentsOfFile:currentPath];
nextPage.image = [UIImage imageWithContentsOfFile:nextPath];

在Allocations中运行,UIImage个对象#living的数量在应用程序运行时保持不变,但#transitory UIImage对象的数量可能会增长很多。

这是一个问题吗?有什么方法可以“释放”UIImage个对象吗?我是否正确地认为这是内存泄漏的根源?

0 个答案:

没有答案
相关问题