Stephane
Stephane

Reputation: 5078

Content positioning into a UIScrollView

I'm trying to add a scroll view to an existing screen of my app to help scroll the screen upward when keyboard hides a text field into this view.

I have added the scroll view as a subview of the main view in Interface Builder. Then I added all other objects as subviews to this scrollview. I have set the scroll view size to 320x460 with x=0 and y=0. Now, I notice the layout is broken and all objects (labels,text fields overlap in the same place).

Do you know the proper way to position this scrollview in interface builder so that I can easily position the other objects?

Thx for helping,

Stephane

Upvotes: 0

Views: 674

Answers (1)

Mundi
Mundi

Reputation: 80265

What you did is correct. It sounds like you moved the other UI elements into the scroll view after you positioned them. In this case they would default to the center position and be overlapped.

If you find it difficult to use dragging in Xcode's Interface Builder, try the position and size tab and type in the coordinates. Alternatively, reposition your UI elements in code.

Upvotes: 1

Related Questions