Skip to content

Instantly share code, notes, and snippets.

@BrunoScheltzke
Created July 6, 2020 21:46
Show Gist options
  • Save BrunoScheltzke/a7898bf1c2fcb5d4b3388e6da352122b to your computer and use it in GitHub Desktop.
Save BrunoScheltzke/a7898bf1c2fcb5d4b3388e6da352122b to your computer and use it in GitHub Desktop.
//
// UIScrollView.swift
//
// Created by Bruno Scheltzke on 07/06/20.
// Copyright © 2020 Bruno Scheltzke. All rights reserved.
//
import UIKit
extension UIScrollView {
func scrollToPage(page: Int, animated: Bool) {
var frame: CGRect = self.frame
frame.origin.x = frame.size.width * CGFloat(page)
frame.origin.y = 0
scrollRectToVisible(frame, animated: animated)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment