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

Discussion in 'iOS Programming' started by stoopkitty, Mar 3, 2011.

  1. stoopkitty macrumors member

    Jan 26, 2010
    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
    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?
  2. jnoxx macrumors 65816


    Dec 29, 2010
    Aartselaar // Antwerp // Belgium
    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.
  3. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    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.
  4. hayesk macrumors 65816

    May 20, 2003
    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.

Share This Page