Drag and move something in Interface builder, without changing parent/superview

interface-builder, ios, xcode

Solution

This has been bothering me as well. I've found a workaround which I find slightly less annoying. Sounds like a lot but it's really quite easy.

- Select the item you want to move

- Goto Editor -> Embed In -> View (this creates a parent view for your item)

- Resize (but don't move) the parent view to encompass the area you want to move to

- Move the item within the parent view

- Select the parent view and Goto Editor -> unembed

Also, since resizing doesn't cause the parent to change you could actually move a view with two resizes. However it's tedious to get the size right again which is why I like the embed method.

Problem

I have some views in interace builder. I have a background view that takes up my entire view area and above it I have some buttons which are NOT in the background view. I want to drag those around to reposition them; but when I do, IB will reparent them when I let go of them. That is to say, IB seems to only understand drag/drop in this case as a reparenting action; not a moving action. Is there a hotkey, or something I can do to make IB just move things, without changing the parent when I let go? This has to be the most painful part of working with IB for me.

Original source