Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you're not using IB then you would get the size of the view and layout based on that. </p> <p>I usually use a single value for the verticalOffset (NSInteger) and base Y values on that with different multiples of the value depending on the interface element. </p> <pre><code>CGRect screenBounds = [[UIScreen mainScreen] bounds]; if (screenBounds.size.height == 568) { // iPhone 5 verticalOffset = 20; } else { verticalOffset = 0; } </code></pre> <p>if in the future Apple releases a iPhone 5.5 with a 768 pixel height (I jest.. ha!) </p> <p>You would only need to add in a new verticalOffset value and the view would instamagically fill the new size.</p> <pre><code>CGRect screenBounds = [[UIScreen mainScreen] bounds]; if (screenBounds.size.height == 768) { // iPhone 5.5 verticalOffset = 30; } else if (screenBounds.size.height == 568) { // iPhone 5 verticalOffset = 20; } else { verticalOffset = 0; } </code></pre> <p>The <strong>easy way</strong> for IB/iPhone if you want to support older iOS versions turn OFF autolayout</p> <p><img src="https://i.stack.imgur.com/qOoGB.png" alt="Turn Off AutoLayout"></p> <p>And turn off auto sizing for the <strong>top value</strong>.</p> <p><img src="https://i.stack.imgur.com/noSZK.png" alt="enter image description here"></p> <p>Layout the view in IB for the iPhone 5 and when you use the iPhone 3.5in all the the interface elements will squeeze into the 3.5in size (make sure you leave enough whitespace when you lay it out in the taller size)</p>
 

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