15

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.

1
  • 1
    done. now changed.
    – ninjaneer
    Jan 29, 2017 at 8:19

2 Answers 2

13

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.

2
  • It works for the latest Xcode when this message was written.
    – SmallChess
    Jan 29, 2017 at 4:52
  • Works on XCode 9.3
    – MH175
    May 18, 2018 at 2:08
6

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

1
  • @CedricSoubrie nope, still gotta do it by the arrows.
    – ninjaneer
    Apr 15, 2015 at 23:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.