[Swift] Add Scroll View

import UIKit

class AboutViewController : UIViewController

  @IBOutlet weak var scrollView: UIScrollView!

  override func viewDidLoad() {
    super.viewDidLoad()

    view.addSubview(scrollView) // Add scroll view to the main view
    
  }

  override func viewWillLayoutSubviews() {
    super.viewWillLayoutSubviews()

    scrollView.contentSize = CGSize( 375, height: 1000) // set scroll view widh and height
  }
}
原文地址:https://www.cnblogs.com/Answer1215/p/6083078.html