How To Reset A Size Class Auto-Layout Back To Its wAny hAny Defaults? How To Reset A Size Class Auto-Layout Back To Its wAny hAny Defaults? xcode xcode

How To Reset A Size Class Auto-Layout Back To Its wAny hAny Defaults?


This should really be an automatic process in Interface Builder, but as far as I know it is not so you have to do the dirty work.

The best solution I have found is a combination of using Interface Builder and the source editor for this task. Remember that there are two things to reset, both the auto-layout constraints as you are referring to, but also the variations you might have created. Lets start with auto-layout constraints, and deal with variations later:

Reseting auto-layout constraints

Find a constraint you want to reset. Choose the "Show Size Selector" panel in the utilities view. At the bottom you will see the size classes this constrain has been added to. If it is only installed on the size class you want to reset, you can delete the whole constraint, otherwise, just delete it from the size class you want to reset by clicking the cross.

Variations

I have only managed to reset variations using the source editor. Either use an external editor, or "Open As -> Source Code", and search for variation elements. Make sure the size class key is correct, and delete at will.


Found a quick fix for this.

In the Storyboard go to the file inspector tab, then, under "Interface Builder Document" Section, uncheck the "Use Size Classes" checkbox and it will ask you to keep either iPhone or iPad current layout.

After choosing it, you can check "Use Size Classes" again and the other size classes will reset to the one you chose before.

Note: All other size classes will reset to the chosen class!