iOS is it ok to use retina display sized artwork on a lower gen iphone?

stoopkitty

macrumors member
Original poster
Jan 26, 2010
62
0
so say i have a background that is 640x960. before i make this the background for my app, do i have to make sure the device has a retina display and if its not set the background as an image that is 320x480? or can i just set it as the background without checking the device.

also, i know that doing it without checking at least looks like it works, because i tried it and it compiled and looked fine, but what does apple reccomend and what is best practice?

also (sorry), if i do need to check if it is an iphone 4, is using
Code:
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2)
an ok way to do this? or would this include ipad or something like that?
 

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
so say i have a background that is 640x960. before i make this the background for my app, do i have to make sure the device has a retina display and if its not set the background as an image that is 320x480? or can i just set it as the background without checking the device.

also, i know that doing it without checking at least looks like it works, because i tried it and it compiled and looked fine, but what does apple reccomend and what is best practice?

also (sorry), if i do need to check if it is an iphone 4, is using
Code:
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2)
an ok way to do this? or would this include ipad or something like that?
There is a more often used check like
#IF_IPHONE4, but not completely sure what the syntax is, u will have to google that, shouldn't be that hard.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
If you use an image that is larger than the frame of the image view then the device will scale the image for you. This does take some processing power and it's possible that you could do a better job of scaling an image in Photoshop than the device does. However, if the appearance looks OK to you and performance seems OK then you can have the device do the scaling. I would say that best practice is to scale it yourself but in many cases letting the device do it is fine.
 

hayesk

macrumors 65816
May 20, 2003
1,422
46
This is spelled out pretty clearly in the documentation. Have an image at 320x480 named yourimage.png and one that is 640x480 named yourimage@2x.png (obviously "yourimage" can be whatever you want)

UIImage will load the correct one.