Kevin Sylvestre Kevin Sylvestre - 1 month ago 10
iOS Question

Image from URL for Retina Display

I have an application that pulls images from an

. Is it possible to inform the application that they are retina ('@2x') versions (the images are of retina resolution)? I currently have the following but the images appear pixelated on the higher resolution displays:

NSURL *url = [NSURL URLWithString:self.imageURL];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *image = [UIImage imageWithData:data];
self.pictureImageView.image = image;


Try using imageWithData:scale: (iOS 6 and later)

NSData *imageData = [NSData dataWithContentsOfURL:url];
UIImage *image = [UIImage imageWithData:imageData scale:[[UIScreen mainScreen] scale]];