UIImage中加载的图像在视网膜上像素化

时间:2012-07-06 17:52:19

标签: iphone image retina-display pixelate

我从包含jpg图像的网页解析数据。问题是图像在视网膜显示器上看起来模糊/像素化。对此有何解决方案?感谢。

NSData *data = [NSData dataWithContentsOfURL:linkUrl];
            UIImage *img = [[UIImage alloc] initWithData:data];   

          //  detailViewController.faces.contentScaleFactor=[UIScreen mainScreen].scale;//Attampt to solve the problem

            detailViewController.faces.image=img;

1 个答案:

答案 0 :(得分:4)

使用数据初始化图像后,使用正确的比例从中创建一个新图像:

img = [UIImage imageWithCGImage:img.CGImage scale:[UIScreen mainScreen].scale orientation:img.imageOrientation];

...但请注意,除非您将其放大,否则图像现在将显示在视网膜显示屏上的一半大小,例如通过在图像视图中拉伸它。

相关问题