Titouan de Bailleul
Titouan de Bailleul

Reputation: 12949

Make UIScrollView fill parent view with constraints

I am simply trying to add a scrollview in the view in Interface Builder and use constraints to have this scroll view fill its superview entirely

This is basically how it looks

enter image description here

Why - when I click on the trailing or leading constraints - is the constant set to -20 instead of 0?

Why - when I run the app and inspect the view - can I see that the view has a width of 375 (running on iPhone 6) but the scrollview has a width of 383?

Upvotes: 1

Views: 593

Answers (1)

Ketan Parmar
Ketan Parmar

Reputation: 27428

Uncheck Constraint to margins when you setting constraint to your scrollview. By default it is checked and it constraints from margin.

check the screenshot below,

enter image description here

Upvotes: 2

Related Questions