ninjaneer
ninjaneer

Reputation: 7031

Interface Builder: Prevent auto adding subview while dragging

I have a scrollview covering the entire screen of the device which is a subview of the main uiview of the interface. I want to add a uibutton on top of the scrollview but everytime I drag a button over the scrollview, IB keeps adding the button as a subview to the scrollview. I don't want it to be a subview of scrollview I have to manually punch in the coordinates of the button to prevent this behavior.

Upvotes: 15

Views: 1115

Answers (2)

Dan Loughney
Dan Loughney

Reputation: 4677

Grab your control and start dragging it. Before you drop it, hold down Command. Drop it. It won't go into the subview.

This is on Xcode 7.2. Not certain about earlier versions.

Upvotes: 13

Sofi Software LLC
Sofi Software LLC

Reputation: 3939

The way I do it is to drag it to the outline, then use the arrow keys to position it. It's annoying for sure.

Related: Xcode 4 Interface Builder - prevent hierarchy changes on positioning

Upvotes: 6

Related Questions