3

使用 UIImagePicker 时,它允许进入编辑模式。然后对于以横向模式拍摄的图像,如果用户不在 UIImagePicker 中手动缩放它,则图像的顶部和底部会有黑色条纹/背景。有没有办法摆脱它并使图像的那部分透明?

4

1 回答 1

2
#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];

    }

}
于 2012-12-11T04:37:56.693 回答