Last active
July 2, 2019 06:24
-
-
Save ssebi/aa3d3e140bd2c67791f507c7a9782ee9 to your computer and use it in GitHub Desktop.
Extension to scroll a UIScrollView to the bottom
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
extension UIScrollView { | |
func scrollToBottom() { | |
let bottomOffset = CGPoint(x: 0, | |
y: contentSize.height - bounds.size.height + contentInset.bottom) | |
if(bottomOffset.y > 0) { | |
setContentOffset(bottomOffset, animated: true) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment