Disable Scroll View Programmatically in iOS?


Scroll View is one of the most difficult and complicated topic an iOS Developer come across. Here we will be seeing how to disable Scroll View Programmatically.

For disabling the same we need to make the “isScrollEnabled” property of our scroll view to false.

Copy the below code in your file.

import UIKit
class ViewController: UIViewController {
   @IBOutlet var scrollView: UIScrollView!
   override func viewDidLoad() {
      super.viewDidLoad()
      scrollView.isScrollEnabled = false
   }
   override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
   }
}

Updated on: 30-Jul-2019

963 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements