Xcode - Is there a way to drag a component from one view to another without losing its frame?

前端 未结 9 566
无人及你
无人及你 2020-12-04 07:22

What I\'d like to do is drag a component/view from one superview to another in Xcode\'s interface-builder without having its frame/position be reset.

Xcode\'s defa

9条回答
  •  广开言路
    2020-12-04 08:07

    I have done something similar to Stepan's solution, without using a storyboard. In the IB while the ViewController's view is open:

    1. Create another view in addition to VC's main view
    2. Move all subviews to the second view by dragging them from one view to another (dragging from the list on the left side resets their position) If you cannot select them from the IB using your mouse then select all from the list on the left side then select one final subview from the IB panel using "cmd" button.
    3. Take them back to the final view on the initial main view.
    4. Remove the added view, all set.

提交回复
热议问题