1

我的应用程序相对简单 - 基本上是UIScrollView查看几百个(大)JPEG。然而,它始终因“内存不足警告”而崩溃

滚动视图由三个UIImageViews(previousPagecurrentPagenextPage)组成。开始时,每次滚动当前页面时,我都会UIImageView用 new “重置”三个 s 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 中运行,#living 对象UIImage的数量在应用程序运行期间保持不变,但 #transitoryUIImage对象的数量可能会增长得相当高。

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

4

0 回答 0