- (UIImage*)scaleToSize:(UIImage*)img size:(CGSize)size{
UIGraphicsBeginImageContextWithOptions(size, NO, [UIScreen mainScreen].scale);
[imgdrawInRect:CGRectMake(0, 0, size.width, size.height)];
UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
returnscaledImage;
}
关键在于 [UIScreen mainScreen].scale
网友评论