iPhone 6 screen resolution?

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

  1. MacMan988 macrumors 6502a

    Jul 7, 2012

    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.

    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


    Oct 30, 2007
    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 G3


    Sep 15, 2011
    Vilano Beach, FL
    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

    Jul 23, 2008
    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