这方法挺实用的,直接调用就可以得到想要的size。

//将一个UIImage缩放变换到指定Size

-(UIImage*) OriginImage:(UIImage *)image scaleToSize:(CGSize)size

{

UIGraphicsBeginImageContext(size);

[image drawInRect:CGRectMake(0, 0, size.width, size.height)];

UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

return scaledImage;

}

05-11 20:24