Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>CGRect screenBounds = [[UIScreen mainScreen] bounds]; </code></pre> <p>That will give you the entire screen's resolution in points, so it would most typically be 320x480 for iPhones. Even though the iPhone4 has a much larger screen size iOS still gives back 320x480 instead of 640x960. This is mostly because of older applications breaking.</p> <pre><code>CGFloat screenScale = [[UIScreen mainScreen] scale]; </code></pre> <p>This will give you the scale of the screen. For all devices that do not have Retina Displays this will return a 1.0f, while Retina Display devices will give a 2.0f and the iPhone 6 Plus (Retina HD) will give a 3.0f.</p> <p>Now if you want to get the pixel width &amp; height of the iOS device screen you just need to do one simple thing.</p> <pre><code>CGSize screenSize = CGSizeMake(screenBounds.size.width * screenScale, screenBounds.size.height * screenScale); </code></pre> <p>By multiplying by the screen's scale you get the actual pixel resolution.</p> <p>A good read on the difference between points and pixels in iOS can be read <a href="http://developer.apple.com/library/ios/documentation/2DDrawing/Conceptual/DrawingPrintingiOS/GraphicsDrawingOverview/GraphicsDrawingOverview.html#//apple_ref/doc/uid/TP40010156-CH14-SW7" rel="noreferrer">here</a>.</p> <p><strong>EDIT:</strong> (Version for Swift)</p> <pre><code>let screenBounds = UIScreen.main.bounds let screenScale = UIScreen.main.scale let screenSize = CGSize(width: screenBounds.size.width * screenScale, height: screenBounds.size.height * screenScale) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload