Problem setting autosizing in interface builder

后端 未结 3 617
被撕碎了的回忆
被撕碎了的回忆 2021-02-05 07:21

I have two viewControllers, one is a subclass of UIViewController (autoresizes correctly), the other one is a subclass of a subclass of UIViewController.
I did a layout in I

相关标签:
3条回答
  • 2021-02-05 07:47

    Open Main.storyboard as source (do not forget, it is just an XML file) and replace "autoresizingMask" tag in the View with the following line:

    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
    
    0 讨论(0)
  • 2021-02-05 07:56

    I ran into this before and it was incredibly frustrating. It turns out that when you have Simulated User Interface Elements turned on then you can't change the struts and springs like you want.

    Go to Attributes tab (Cmd-1) and make sure that Status Bar, Top Bar, Bottom Bar, and Split View are all set to "Unspecified." Then go back to the Size tab (Cmd-3) and you'll be able to click the lines and changes your Struts and Springs. Then finally you can go back to Cmd-1 and turn those simulated elements back on.

    0 讨论(0)
  • 2021-02-05 08:03

    I have a simplified answer:

    1. Goto IB
    2. Click on the 'ViewController'
    3. Goto 'Attributes Inspector'
    4. Change 'Size' to 'Freeform' (something other than 'Inferred')

    What you have is this:

    enter image description here

    Change 'size' to 'freeform' & try now!

    enter image description here

    Now, it works! Go back & change it to 'Inferred' after you have set the Autoresizing masks.

    0 讨论(0)
提交回复
热议问题