Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add UIScrollView to Interface builder?

Tags:

I have all my controls laid out in interface builder (many labels, buttons etc). How do I put them all in a scroll view in interface builder so that I can have more space and be able to scroll up and down to reveal more controls? Do I have to do this programatically?

like image 994
erotsppa Avatar asked Oct 05 '09 17:10

erotsppa


People also ask

How do I create a scroll view?

In order to place multiple views in the scroll view, one needs to make a view group(like LinearLayout) as a direct child and then we can define many views inside it. A ScrollView supports Vertical scrolling only, so in order to create a horizontally scrollable view, HorizontalScrollView is used.

How do I constrain a scroll view in Swift?

Put a view(contentView) inside the scroll view and set constraints (leading, top, trailing, bottom - all 0) In views hierarchy, do ctrl drag from new View(contentView) to Content Layout guide of scrollView and in the appeared context menu choose all constraints (leading, top, trailing, bottom - all 0)


1 Answers

Open the view that has all the controls and labels, etc. (in Interface Builder). Select All. Then under the Editor menu, select Embed In, then Scroll View.

Note: in older Xcode versions, this is under the Layout menu, then Embed Objects In... (scroll view).

like image 87
mahboudz Avatar answered Sep 22 '22 09:09

mahboudz