使用UIImagePicker时,它允许进入编辑模式。然后对于使用横向模式拍摄的图像,如果用户不在UIImagePicker中手动缩放,则图像的顶部和底部会出现黑色条纹/背景。有没有办法摆脱它,使图像的那部分透明?
答案 0 :(得分:3)
#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];
}
}