我有两张图片。一个保存在捆绑包中
NSString *imagePath = [NSString stringWithFormat:@"%@/%@",_path,[contents objectAtIndex:0]];
另一个保存在文件夹中
NSFileManager *filemanager = [NSFileManager defaultManager];
NSArray *contents = [filemanager contentsOfDirectoryAtPath:_path error:nil];
NSString *imagePath = [NSString stringWithFormat:@"%@/%@",_path,[contents objectAtIndex:0]];
将图像加载到 UIImageView
_avatar = [UIImage imageWithContentsOfFile:filePath];
如果我从 bundle 加载图像,使用内存增加到 2Mb 如果我从文档加载图像,使用内存增加到 40mb 两个图像的大小都是 2448x3264
这里确实有错误。