I have a UIScrollView with 10 pages. I am able to flick between them. I also want to have 2 buttons (a back button and a next button) which when touched will go to the previ
First create a UIScrollView extension like:
extension UIScrollView {
func setCurrentPage(position: Int) {
var frame = self.frame;
frame.origin.x = frame.size.width * CGFloat(position)
frame.origin.y = 0
scrollRectToVisible(frame, animated: true)
}
}
then just call:
self.scrollView.setCurrentPage(position: 2) // where 2 is your desired page