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.
   }
}
karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know


Advertisements