How to get rid of the black ground on the image returned from UIImagePickerControllerEditedImage when using UIImagePicker

前端 未结 1 2015
盖世英雄少女心
盖世英雄少女心 2021-01-23 00:24

When using UIImagePicker, it allows to get into Edit mode. Then for an image taken with landscape mode, if user don\'t scale it manually within the UIImagePicker, there would ha

1条回答
  •  盖世英雄少女心
    2021-01-23 00:33

    #pragma mark UIImagePickerControllerDelegate
    
    - (void)imagePickerController:(UIImagePickerController *)picker  didFinishPickingMediaWithInfo:(NSDictionary *)info {
    
        UIImage *img = nil;
    
        CGRect cropRect = [[info valueForKey:UIImagePickerControllerCropRect] CGRectValue];
    
        if (cropRect.origin.y < 0) {
    
            img = [info objectForKey:UIImagePickerControllerOriginalImage];
    
        } else {
    
            img = [info objectForKey:UIImagePickerControllerEditedImage];
    
        }
    
    }
    

    0 讨论(0)
提交回复
热议问题