Getting image from UIImagePickerController

后端 未结 4 758
野的像风
野的像风 2021-02-15 04:08

I want to get the image frm imagepickercontroller.But my code doesn\'t have any effect Here is the code..

- (void)imagePickerController:(UIImagePick         


        
4条回答
  •  再見小時候
    2021-02-15 04:37

    You can try this code to access an Image returned from the picker

    - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    
        [picker dismissModalViewControllerAnimated:YES];
    
        UIImage* originalImage = nil;
        originalImage = [info objectForKey:UIImagePickerControllerEditedImage];
        if(originalImage==nil)
        {
            originalImage = [info objectForKey:UIImagePickerControllerOriginalImage];
        }
        if(originalImage==nil)
        {
            originalImage = [info objectForKey:UIImagePickerControllerCropRect];
        }
      //At this point you have the selected image in originalImage
        [self saveImageToDocumentDirectory:originalImage];
    }
    

提交回复
热议问题