ios – 从UIImagePickerController获取图像

前端之家收集整理的这篇文章主要介绍了ios – 从UIImagePickerController获取图像前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想得到图像frm imagepickercontroller.But我的代码没有任何影响
这是代码..
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [picker dismissModalViewControllerAnimated:YES];
    imageview.image = [UIImage imageNamed:[info objectForKey:@"UIImagePickerControllerOriginalImage"]];

解决方法

您可以尝试使用此代码来访问从选择器返回的Image
- (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];
}
原文链接:https://www.f2er.com/iOS/332629.html

猜你在找的iOS相关文章