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; }
时间: 2024-10-14 21:03:21