Search code examples
iosxcodeuiviewuiscrollview

Why do my controls get squished inside a scroll view?


I'm building an iOS app and every time I use a scroll view and put other views and controls inside of it this happens:

xCode Picture

How do I prevent this from happening? I tried putting the scroll view in a UIView and putting a UIView inside a scroll view and putting other controls inside of the nested views but the same thing still happens. Any ideas on how to fix this?


Solution

  • Instead of using constraints use the autoresizing feature. The controls resize depending on the way they were placed on screen and what the settings on the Autoresizing is.

    Autoresizing