문제

I parsed the data from a web which also contains jpg image. The problem is that the image looks blurry/pixelated on retina display. Any solution for this? Thanks.

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;
도움이 되었습니까?

해결책

After initializing your image with the data, create a new one from it with the correct scale like this:

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

...but note that the image will now appear half the size on retina displays unless you scale it up, for example by stretching it in an image view.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top