Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To automatically change the layout of your view in interface builder, you have to set the autoresizing mask option of all graphical objects of your view. You can either do it programmatically like : </p> <pre><code>myObj.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; </code></pre> <p>Or with Interface builder in the Size Inspector tab of each object. You should see something like this : </p> <p><img src="https://i.stack.imgur.com/mSBKv.png" alt="enter image description here"></p> <p>When the line is red, it means the margin (<strong>regarding the object container</strong>) will stay the same if device orientation change. In other case, the margin will change to adapt the object placement in the view container.</p> <p>Unlikely, when a row is in NOT in red, it means the size of teh object will stay the same in all device orientations, else the size will be modified (useful for background image for example)</p> <p>So, in the example above the object size will not change, and the left and top margin will not change either regarding its container.</p> <p>Hope this is clear enough. Do not hesitate to react in case it's not clear</p> <p><em>EDIT</em></p> <p>You can check the result of your resizing mask without re-compiling the application simply by doing the trick below : </p> <ul> <li>Select the uiviewcontroller main view (self.view)</li> <li>Go to the Attributes Inspector</li> <li>In section "Simulated Metrics" you should see an 'Orientation' Item</li> <li>Switch off and on from 'Portrait' to 'Landscape' to see the resulted view</li> </ul> <p><em>EDIT1</em></p> <p>If I correctly understand what you means, I think you can do it this way : </p> <p><img src="https://i.stack.imgur.com/EVlan.png" alt="enter image description here"></p> <p>Placing your button and your shadow image view in a view container. Then set the view container autoresizing as you are doing right know for your button and lock the button and image view size/margins regarding this view container. </p> <p>That should work.</p>
    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. 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.
 

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