iPhone 6 screen resolution?

Discussion in 'iOS Programming' started by MacMan988, Jan 5, 2015.

  1. MacMan988 macrumors 6502a

    Joined:
    Jul 7, 2012
    #1
    Hi,

    I need to programatically check for the screen size and if it is iPhone 6 then the app should load the background image with the correct size.

    I used the bellow code to check the screen size.

    Code:
    CGRect screenRect = [[UIScreen mainScreen] bounds];
    CGFloat screenWidth = screenRect.size.width;
    CGFloat screenHeight = screenRect.size.height;
    This returns 667 x 375.

    But when I set the UIImageView's frame to 0, 0, 667, 375 it doesn't fit the screen (my app runs in the landscape orientation only). I figured it out that the 1080 x 768 size makes the UIImageView fitting the entire screen. I'm confused as this is neither the resolution read in points or the native resolution of the device?
     
  2. DannyBres macrumors 65816

    DannyBres

    Joined:
    Oct 30, 2007
    Location:
    UK
    #2
    Sounds odd. it should work.

    But this is not the way Apple is advicing you deal with various size screens, check out auto layout.

    ----------

    Can you post the code the image and a screen shot of the result?
     
  3. D.T. macrumors 603

    D.T.

    Joined:
    Sep 15, 2011
    Location:
    Vilano Beach, FL
    #3
    I would write a helper class to detect the _device_ and use that to fetch images with a device specific prefix/suffix, then just build out your assets to the proper specification.
     
  4. kage207 macrumors 6502a

    Joined:
    Jul 23, 2008
    #4
    Along with D.T.'s advice, you should really remember that UIImageView is actually returning the points available to draw your image.
     

Share This Page