UIScrollView with AutoLayout

Thursday, May 18th, 2017

Many iOS Developers have one common problem of using AutoLayout with UIScrollView. It is not that difficult, you just need to take fews things in mind.

Step 1

Add Scroll View to the main UIView and give constraints with respect to UIView.

UIScrollView

 

Step 2

Add a content view (UIView) inside the ScrollView and give Top, bottom, left and right constraints w.r.t ScrollView. And also add equal width and equal height constraints w.r.t main UIView.

content view

content view

 

Step 3

Set the equal height constraint’s priority to low if you need vertical scrolling

height constraint’s priority

height constraint’s

Step 4

Now you can add any contents inside the Content View and add constraints w.r.t ContentView.

Hope you follow all the steps and be able to get AutoLayout with UIScrollView.

Related Articles

  • Youtube Ad Auto-skipper

    Like many people, YouTube has become my primary source of music. I listen to its automatic playlists all the time, and the fact that it seems to learn my preferences and introduces me to new music is just awesome. There is just one annoyance: YouTube ads Now, I don’t hate ads. I actually find them […]

    read more
  • Caching Server

    Squid: Saving your internet bandwidth

    With the increase in a number of digital devices, organizations are facing bandwidth issues. Users within the organization are downloading same content multiple times resulting in the consumption of international bandwidth. A simple solution might be to increase the bandwidth. But, can there be ways to solve this problem? The answer is “YES”. Caching servers […]

    read more

Let us build something great together!

Start a project