简体   繁体   中英

UIImagePicker save image to camera Roll Ipad

so I'm shooting up a camera (Ipad, 5.0, ARC), allow me to take picture.. it gives you a preview after taking the picture. The two options are "use" and "retake" in the preview. I'm unsure where you attempt to define the name of the photo and store in the camera roll. Even via NSLog I can't see anything called w/ the use button.. the tutorials don't seem to be working for me either. There's one that Ipad specific on technopedia that most people reference.

So you are using a UIImagePickerController to take a picture on the iPad, and you want to know how to save it? For this, you need to be the delegate of the UIImagePickerController, then implement the following method:

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

In this delegate callback you can get the UIImage that was just taken by getting the value of the info dictionary with key UIImagePickerControllerOriginalImage . To then save this image to the camera roll, you use:

void UIImageWriteToSavedPhotosAlbum (UIImage  *image, id completionTarget, SEL completionSelector, void *contextInfo);

There is no such thing as an image name in the iOS assets library, so you cannot name the image.

It is also possible to save the image using the Assets Library, see this post for more details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM