Created
July 6, 2020 21:46
-
-
Save BrunoScheltzke/a7898bf1c2fcb5d4b3388e6da352122b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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