更新时间:2023-01-15 12:17:23
UIImage调整大小:通过这个链接。
UIImage resize : Go thru this link.
感谢Paul Lynch。
Thanks to Paul Lynch.
+ (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize {
UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
[image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}