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

aroth picture aroth · Jul 16, 2012 · Viewed 26.3k times · Source

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 default behavior when doing this appears to be to center the view being moved vertically and horizontally in its new superview, while preserving its dimensions. This is extremely frustrating, as it means that the view needs to be manually repositioned in its new superview. But I had it positioned correctly before I moved it, so I'd like Xcode to just remember all attributes of its frame instead of just its width/height. Is this possible?

Answer

Jay picture Jay · Jun 6, 2013

Another solution:

  1. Select the items you want in your subview, then
  2. (in the tool bar) Editor > Embed In > view type to embed in.