UIScrollView not scrolling in Swift
You need to set the frame
of your UIScrollView
so that it is less than the contentSize
. Otherwise, it won't scroll.
Also, I would recommend that you add the following to your viewDidLoad
method:
scroller.contentSize = CGSize(width: 400, height: 2300)
If you are using AutoLayout
Set content size in viewDidAppear which works for me.
override func viewDidAppear(_ animated: Bool) {
scrollView.contentSize = CGSize(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height+300)
}