缩放的UIImage到指定大小

//将originImage缩放到指定大小newSize。

//用处:originImage太大时,缩放到指定大小后,可以释放originImage从而减少内存占用。

+(UIImage*)scaledImageFromImage:(UIImage*)originImagetoSize:(CGSize)newSize

{

UIGraphicsBeginImageContext(newSize);[originImagedrawInRect:CGRectMake(0,0,newSize.width,newSize.height)];

UIImage*newImage=UIGraphicsGetImageFromCurrentImageContext();UIGraphicsEndImageContext();returnnewImage;

}



你可能感兴趣的:(缩放的UIImage到指定大小)