iOS上直接缩小UIImageView的大小会产生锯齿,可以先将其缩放后再使用.
- (UIImage *)scaleToSize:(UIImage *)img size:(CGSize)size {
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
[img drawInRect:CGRectMake(0, 0, size.width, size.height)];
UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return scaledImage;
}
转载于:https://blog.51cto.com/181911195/1693135