Skip to content

Instantly share code, notes, and snippets.

@ssebi
Last active July 2, 2019 06:24
Show Gist options
  • Save ssebi/aa3d3e140bd2c67791f507c7a9782ee9 to your computer and use it in GitHub Desktop.
Save ssebi/aa3d3e140bd2c67791f507c7a9782ee9 to your computer and use it in GitHub Desktop.
Extension to scroll a UIScrollView to the bottom
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