Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 将UIImage的NSArray保存到磁盘_Objective C_Uiimage_Nsarray - Fatal编程技术网

Objective c 将UIImage的NSArray保存到磁盘

Objective c 将UIImage的NSArray保存到磁盘,objective-c,uiimage,nsarray,Objective C,Uiimage,Nsarray,我想知道是否有可能将包含UIImage的阵列保存到ipad的磁盘上?我的想法是不保存他们的每一个图像作为PNG或JPG的文件夹中的图像。是否有可能保存整个阵列并稍后加载 Andy如果您保留NSData数组而不是UImage,并且从这些NSData对象创建图像,那么Andy应该是可能的,但我想这不是您想要的Mh不,我认为这可能是解决方案,因为我有可能在数组中保留NSDate而不是UIImage。比[myNSDataArray writeToFile:…]?:)mh更可行,这不是我想要的方式。因为我

我想知道是否有可能将包含UIImage的阵列保存到ipad的磁盘上?我的想法是不保存他们的每一个图像作为PNG或JPG的文件夹中的图像。是否有可能保存整个阵列并稍后加载


Andy

如果您保留NSData数组而不是UImage,并且从这些NSData对象创建图像,那么Andy应该是可能的,但我想这不是您想要的

Mh不,我认为这可能是解决方案,因为我有可能在数组中保留NSDate而不是UIImage。比[myNSDataArray writeToFile:…]?:)mh更可行,这不是我想要的方式。因为我认为我在使用UIImagePNGRepresentation时会丢失信息,是不是?否则,我将保存NSData数组并将其写入文件。
int i = 0;
for(UIImage* img in image_array) {
    [UIImagePNGRepresentation(img) writeToFile: [NSString stringWithFormat: @"%@(%d)", path, i++] atomically: YES];
}