DirtyNative
DirtyNative

Reputation: 2834

Xcode Scrollview wrong constraints

I designed a UI in Xcode with a ScrollView and added constraints to it. In Interface designer it looks as I want, but running it with the simulator causes a big spacing at the right side of the ContentView inside the ScrollView.

Here are two pics to show what I mean

enter image description here enter image description here

So what did I do wrong here?

Thanks for your helping hand

Solution

The ContentView needed the same width than the View. So select both, go to your constraints and select "Equal Widths".

Upvotes: 0

Views: 117

Answers (2)

K. Michał
K. Michał

Reputation: 1053

I had this same issue after updating to xcode 8+. ScrollView started to act strange. For now I am adding constrains from inside scrollView to another view witch isn't in scrollView itself (like leading, trailing) to mainView.

Upvotes: 0

Duncan Lowrie
Duncan Lowrie

Reputation: 116

It looks to me as though you haven't added constraints to the scroll view (ScrollViewer) to pin its edges to its parent view (View).

Upvotes: 0

Related Questions