Skip to content

Instantly share code, notes, and snippets.

@dinobei
Created July 4, 2018 07:18
Show Gist options
  • Save dinobei/16df749356876a9353fd6672281c3db9 to your computer and use it in GitHub Desktop.
Save dinobei/16df749356876a9353fd6672281c3db9 to your computer and use it in GitHub Desktop.
Scrolling NSScrollView programatically (swift 4.0, cocoa in macOS)
class ViewController {
...
override func viewDidAppear() {
...
// scrolling to top
scrollView.documentView?.scroll(NSPoint(x: 0, y: documentView.bounds.size.height))
// scrolling to bottom
scrollView.documentView?.scroll(NSPoint.zero)
...
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment