使用UIImagePickerController拍摄的照片或图像的本地地址

时间:2014-08-21 09:56:42

标签: ios uiimagepickercontroller

我使用UIImagePickerController拍摄照片或从相册中选择照片。在这里,我将所选图像放到imageView:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

    UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
    self.temporaryImageView.image = chosenImage;
    [picker dismissViewControllerAnimated:YES completion:NULL];
}

但是如何在设备上获取所选照片的​​地址?还是它的名字?有可能吗?

1 个答案:

答案 0 :(得分:0)

可能这可以帮到你;

NSMutableString *imageName = [[[NSMutableString alloc] initWithCapacity:0]];

CFUUIDRef ref = CFUUIDCreate(kCFAllocatorDefault);
if (ref) {
    [imageName appendString:NSMakeCollectable(CFUUIDCreateString(kCFAllocatorDefault, theUUID))];
}
[imageName appendString:@".png"];

我还建议你查看这个答案; https://stackoverflow.com/a/16184616/2622013