Skip to content

Instantly share code, notes, and snippets.

@tiagobbraga
Last active October 27, 2020 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tiagobbraga/422c9ba9d1274b5adb134fb09e311f68 to your computer and use it in GitHub Desktop.
Save tiagobbraga/422c9ba9d1274b5adb134fb09e311f68 to your computer and use it in GitHub Desktop.
UIScrollView Scrollable Content Size Ambiguity
Xcode 11+
The simplest way using autolayout:
1. Add UIScrollView and pin it 0,0,0,0 to superview (or your desired size)
2. Add UIView in ScrollView, pin it 0,0,0,0 to all 4 sides and center it horizontally and vertically.
3 .In size inspector, change bottom and align center Y priority to 250. (for horizontal scroll change trailing and align center X)
4. Add all views that you need into this view. Don't forget to set the bottom constraint on the lowest view.
5. Select the UIScrollView, select the size inspector and deselect Content Layout Guides.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment