Search code examples
iphoneios-simulatoriphone-4retina-display

display image in iphone 4 retina display


I am showing a high resolution image in iphone 4 and i set the image view frame size as below : imageFrameNormal.size.width = 470; imageFrameNormal.size.height = 625;

but it showing full screen instead of this size. so plz can any one suggest how i show image in right size. i am trying to check it in simulator.

Thx


Solution

  • You have to use the same sizes on retina and normal displays. For example, you have image view with size 100x100. On retina device you should use the same size 100x100 (no changes in your code). However you'd better use high-res image (2x size). For this you need to name it properly: image.png - normal size image [email protected] - 2x size image.

    When you call

    UIImage* img = [UIImage imageNamed: @"image.png"];
    

    image.png would be used on normal display and [email protected] on retina (iOS does it automatically).