możesz użyć następującej funkcji do move
wszystkich swoich zdjęć do nowej Path
.
Trzeba pass
właśnie zarówno DirectoryPath
Old
i New
- (void)moveFileFromFolder:(NSString *)oldFolderPath toFolder:(NSString *)newFolderPath {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *fileNames = [fileManager contentsOfDirectoryAtPath:oldFolderPath error:nil];
for (NSString *fileName in fileNames) {
NSString * oldFilePath = [oldFolderPath stringByAppendingString:fileName];
NSString * newFilePath = [newFolderPath stringByAppendingString:fileName];
NSError *error = nil;
[fileManager moveItemAtPath:oldFilePath toPath:newFilePath error:&error];
if (error) {
NSLog(@"error = %@", [error description]);
return;
}
}
}
i jak mogę dostać ścieżka mam [kod] (http://dpaste.com/3G6WE6P)? –
'UIImagePickerControllerOriginalImage' zwraca tylko dane obrazu, bez odniesienia do lokalnej pamięci. Nie użyłem go samodzielnie, ale domyślam się, że to, czego szukasz, to: NSURL * localUrl = (NSURL *) [info valueForKey: UIImagePickerControllerReferenceURL]; Przynajmniej, to jedyny znany mi sposób pobrania dowolnego adresu URL. –
LUB możesz użyć w następujący sposób .. 'UIImage * obraz; [UIImagePNGRepresentation (image) writeToFile: @ "Twoja niestandardowa ścieżka" atomowo: TAK]; ' –