Mgi*_*404 3 iphone uiimageview ios
我一直在使用UIImageView类渲染图像时遇到问题.像素化似乎主要发生在我试图展示的图像的边缘.
我试过更改属性'渲染边缘抗锯齿'无济于事.
图像文件包含的图像大于屏幕上显示的图像.
这似乎是皇室混乱图像的质量,然后显示它.我试图在这里发布图片,但StackOverflow正在否认我的特权.所以这里有一个链接到正在发生的事情.
http://i.imgur.com/QpUOTOF.png
这张照片中的太阳是我所说的问题.有任何想法吗?
动态图像调整大小快速且质量低.对于捆绑的图像,额外的捆绑空间值得包括缩小版本.对于下载的图像,通过UIImage在设置图像属性之前将Core Graphics调整为新图像,可以获得更好的效果.
CGSize newSize = CGSizeMake(newWidth, newHeight);
UIGraphicsBeginImageContextWithOptions(newSize, // context size
NO, // opaque?
0); // image scale. 0 means "device screen scale"
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetInterpolationQuality(context, kCGInterpolationHigh);
[bigImage drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2280 次 |
| 最近记录: |