3

I facing some trouble while updating my application to be compatible with 3.5' and 4.0' displays(iPhone 5).When i add graphics(png image) to my view,if the device is 3.5' display everything is showed correctly but when i launch the view in a 4.0' device the image remains the same as 3.5' inch(ex:myimage@2x.png - 640x960px).So how can i change images when the device display is 4.0' so a 640x1136px image would be displayed?

More clearly:

  1. Display = 320x480px => my image.png
  2. Display = 640x960px => myimage@2x.png
  3. Display = 640x1136px => myimage { HOW DO DISCERN THIS RESOLUTION } .png
Mateus
  • 2,640
  • 5
  • 44
  • 62
  • Did you have any luck in getting something like this to work? I am faced with the very same problem right now and thinking of writing a category for UIImage that uses one of the UIDevice-categories from http://stackoverflow.com/questions/12396545 – patric.schenke Jun 06 '13 at 09:14

2 Answers2

0

Just drag the image you want to use in the splash screen box in the application summary. Maybe change window size to 4.0 in IB. Rest should be magic.

Also check this iOS 6 apps - how to deal with iPhone 5 screen size?

Community
  • 1
  • 1
nooitaf
  • 1,466
  • 11
  • 18
  • This is not about the default splash screen but a UIImageView inside a view! – Mateus Sep 16 '12 at 03:29
  • How about autoresizingMask? `view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight` or `myimage568h@2x.png` ? – nooitaf Sep 16 '12 at 03:36
  • I believe resizing would downgrade the image quality,which is not an option.What i really want to know if there is any suffix to identify a 4'display image and display it. – Mateus Sep 16 '12 at 03:40
  • i believe there will never be one, as its a different ratio. you could also try to take the 568h image for all and tell it to scale to fit or bottom, depends on the image. but thats what i did. – nooitaf Sep 16 '12 at 03:45
0

Here is a blog-post that offers a solution by swizzling UIImage's imageNamed: http://angelolloqui.com/blog/20-iPhone5-image-loading

It's not mine, I'm just posting it here in case somebody finds this question before they find that posting (like me).

Of course, your app might be rejected for using method-swizzling on framework-classes.

patric.schenke
  • 942
  • 11
  • 19