How to convert frame based on device screen size?
<p>I'm working on a dynamic app in which I'm getting <code>CGRect</code> separately (x, y, width, height) values from a web service for each of the UI objects inside a view.</p>
<p>On server, they will set frames based on following size (1080 x 1920), so lets say, if I'll get a <code>CGRect</code> with following values: (200, 20, 100, 100) then it should be fit into device based on device size and server specified size.</p>
<blockquote>
<ol>
<li><p>So with case of iPhone 5 - new frame will be same 200, 20, 100, 100.</p>
</li>
<li><p>So with case of iPhone 6 (375 x 667) - new frame will be ?</p>
</li>
<li><p>So with case of iPhone 6+ (414 x 736) - new frame will be ?</p>
</li>
</ol>
</blockquote>
<p>The main thing is that, whatever the frame will be received into the app for a particular UI object, it should be looks exactly as in admin panel specially for margins.</p>
<p>For a note,</p>
<blockquote>
<p>I'm setting UI with AutoLayout in Storyboard only.</p>
</blockquote>
<p>Any suggestion?</p>
<p>This is an example:</p>
<p>Example 1:</p>
<pre><code>|  _________________  |
| |                 | |
| |                 | |
| |                 | |
| |                 | |
| |_________________| |
|                     |
</code></pre>
<p>Example 2:</p>
<pre><code>|          _________  |
|         |         | |
|         |         | |
|         |         | |
|         |         | |
|         |_________| |
|                     |
</code></pre>
<p>By above examples, I'm trying to explain that, by whatsoever frame will be coming from server, if this looks like above on server, the similar would be on device, but it should be based on device <code>CGRect</code>.</p>