照片存入沙盒
作者:
二猪哥 | 来源:发表于
2019-07-11 16:05 被阅读0次 // 本地沙盒目录
NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString *imageFilePath = [path stringByAppendingPathComponent:[NSString stringWithFormat:@"image_%ld",(long)self.imageUrlsCount]];
self.imageUrlsCount = self.picBigImages.count;
[self.imageUrls addObject:imageFilePath];
// 将取得的图片写入本地的沙盒中,其中0.5表示压缩比例,1表示不压缩,数值越小压缩比例越大
BOOL success = [UIImageJPEGRepresentation(image, 0.5) writeToFile:imageFilePath atomically:YES];
if (success){
NSLog(@"写入本地成功");
}
本文标题:照片存入沙盒
本文链接:https://www.haomeiwen.com/subject/mlydkctx.html
网友评论