Ios 屏幕上显示3幅图像的ALAsset库、ALAsset和内存警告
我的应用程序使用AlassetLibrary和ALAsset检索最后100张照片。我应用延迟加载技术来避免在屏幕上加载超过3个图像。这就是流程: 使用AlassetLibrary循环资产,以获得最后100个 将每个数据集存储在NSMUTABLEARRY中: [self.pageImages addObject:asset] 在屏幕上最多加载3个图像:一个图像现在要查看,一个图像用于下一页,一个用于上一页 滚动到下一个图像将删除上一个图像,并向视图中添加一个新图像 但我仍然会收到内存警告,尤其是当滑动/滚动太快时 处理ALAsset还有哪些其他建议或方法?代码如下:Ios 屏幕上显示3幅图像的ALAsset库、ALAsset和内存警告,ios,objective-c,iphone,memory-management,alassetslibrary,Ios,Objective C,Iphone,Memory Management,Alassetslibrary,我的应用程序使用AlassetLibrary和ALAsset检索最后100张照片。我应用延迟加载技术来避免在屏幕上加载超过3个图像。这就是流程: 使用AlassetLibrary循环资产,以获得最后100个 将每个数据集存储在NSMUTABLEARRY中: [self.pageImages addObject:asset] 在屏幕上最多加载3个图像:一个图像现在要查看,一个图像用于下一页,一个用于上一页 滚动到下一个图像将删除上一个图像,并向视图中添加一个新图像 但我仍然会收到内存警告,尤其是当
ALAsset * asset = [self.pageImages objectAtIndex:page];
NSLog(@"asset %@",asset);
ALAssetRepresentation *arep = [asset defaultRepresentation];
// Retrieve the image orientation from the ALAsset
UIImageOrientation orientation = UIImageOrientationUp;
NSNumber* orientationValue = [asset valueForProperty:@"ALAssetPropertyOrientation"];
if (orientationValue != nil) {
orientation = [orientationValue intValue];
}
CGFloat scale = 1;
UIImage *img = [UIImage imageWithCGImage:[arep fullResolutionImage]
scale:scale orientation:orientation];