更新时间:2023-01-24 13:54:39
您可以创建图形上下文,将图像绘制成所需比例的图像,然后使用返回的图像。例如:
You can create a graphics context, draw the image into that at the desired scale, and use the returned image. For example:
UIGraphicsBeginImageContext(CGSizeMake(480,320));
CGContextRef context = UIGraphicsGetCurrentContext();
[image drawInRect: CGRectMake(0, 0, 480, 320)];
UIImage *smallImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();