こんにちは、私は実際に私のNSDocumentDirectory
.Imで保存するのに苦労しAGImagePicker
ています。はい、これを に保存できましたNSDocumentDirectory
。ただし、それらを一意に保存する方法(独自の観点から名前をに変換する方法oneSlotImages
)または一意のIDで保存してからロードする方法。申し訳ありませんが、私はこのUIImagePickerControllerMediaURL
ことに少し慣れていません。保存時にそれらが重複しないという私の他の問題に対する私の解決策になると思います。一意の ID を使用してこれを保存する方法、またはUIImagePickerControllerMediaURL
.
for (int i = 0; i < info.count; i++) {
NSLog(@"%@", [info objectAtIndex:i]);
NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask ,YES );
NSString *documentsDir = [paths objectAtIndex:0];
NSString *savedImagePath = [documentsDir stringByAppendingPathComponent:[NSString stringWithFormat:@"oneSlotImages%d.png", i]];
ALAssetRepresentation *rep = [[info objectAtIndex: i] defaultRepresentation];
UIImage *image = [UIImage imageWithCGImage:[rep fullResolutionImage]];
//----resize the images
image = [self imageByScalingAndCroppingForSize:image toSize:CGSizeMake(256,256*image.size.height/image.size.width)];
NSData *imageData = UIImagePNGRepresentation(image);
[imageData writeToFile:savedImagePath atomically:YES];
助けてくれてありがとう。とても有難い。