Skip to main content

UIImageView retina

By July 24, 2012December 18th, 2013Blog

When setting up an image to the UIImageView for dbl resolution for retina display make sure to set the image after setting the frame of the view as initWithImage on UIImageView does not work properly.

 

1
2
UIImageView *backgroundImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
[backgroundImageView setImage:[UIImage imageNamed:@"bg-wall01.jpg"]];

 

Where in resources we have file named “bg-wall01@2x.jpg”, iOS4 does the trick for us to set the image scale to 2.0 for us (or rather 0.5 in fact).

Happy coding!