//将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;
}











网友评论