Titouan de Bailleul Titouan de Bailleul - 1 year ago 148
iOS Question

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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download