-1

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

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

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

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

4

1 回答 1

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();

}

于 2013-07-11T10:55:12.063 回答