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 few things in mind.

Step 1

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

Step1 UIScroll


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.

Step2a UIScroll


Step2b UIScroll

Step 3

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



height constraint priority

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

  • Node.js enterprise security gets better

    Node.js enterprise security gets better

    Node.js Interactive North America, npm, Inc. announced new enterprise-grade security features for users of npm and the npm Registry. It added two-factor authentication for publishing packages and read-only authentication tokens. npm is the first software registry to provide two-factor authentication for publishers. The 8.8 million developers and hundreds and thousands of companies who download over […]

    read more
  • Microsoft Edge for Android now available on the Play Store

    Microsoft Edge for Android now available

    Microsoft made Android version of the new Edge browser available on the Play Store. Last week Microsoft had released Edge on iOS and Android for Windows Insider users. Microsoft Edge on iOS and Android is for the users who use it on desktop and want to sync with it. It is similar to Safari and […]

    read more
  • Kotlin overtakes Java among Android developers

    Kotlin overtakes Java among Android developers

    Since Google officially made Kotlin a first-class language for writing Android apps, announced at Google I/O in May 2017, 20 percent of applications were built using Kotlin since the conference which had previously been built with Java. The percentage of Android applications built using Java decreased by 6.1 percent and dropped from 50.7 percent to […]

    read more

Let us build something great together!

Start a project