Move all subviews to container view keeping positions and constraints

后端 未结 2 1008
不思量自难忘°
不思量自难忘° 2021-02-18 13:07

I\'m using Xcode 5 and autolayout in my project. I have a .xib file with a lot of subviews and constraints between them. Now I need to create an intermediate fullsc

2条回答
  •  南旧
    南旧 (楼主)
    2021-02-18 13:43

    Add your container view to the hierarchy (to get an object ID) in Interface Builder and close the view. Edit the .xib file manually, in a text editor, and move all subviews to be under the container view. Constraints are created in IB with references to IB object IDs, so you will have to replace the constraints from referencing the superview with the container; a quick replace run should be sufficient.

提交回复
热议问题