[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(width: 375, height: 1000) // set scroll view widh and height
  }
}

 

posted @ 2016-11-20 18:14  Zhentiw  阅读(178)  评论(0编辑  收藏  举报