在 iOS 中以程式設計方式停用滾動檢視?
滾動檢視是 iOS 開發人員遇到的最困難和最複雜的話題之一。這裡我們將瞭解如何以程式設計方式停用滾動檢視。
要進行停用,我們需要使我們滾動檢視的“isScrollEnabled”屬性變為 false。
在你的檔案中複製以下程式碼。
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. } }
廣告