IOS有没有很好的例子来获取没有剪辑的图片?

时间:2013-07-11 10:08:24

标签: ios uiimagepickercontroller

默认情况下,当我们从ios相册中获取图像时,它总是会被剪裁。

然而,如果我们使用UIImagePickerControllerOriginalImage,那么它太大了。

(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    UIImage*temp =[info objectForKey:UIImagePickerControllerEditedImage];
}

有没有好的方法来编辑图像而不剪切它的范围?

1 个答案:

答案 0 :(得分:0)

也许是这样......

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    UIImage*temp =[info objectForKey: UIImagePickerControllerOriginalImage];
    CGSize newSize = CGSizeMake("WIDTH", "HEIGHT");  <---- SET YOUR VALUES
    UIGraphicsBeginImageContext(newSize);
    [temp drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
    UIImage* smaller = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

}