Programmatically scroll NSScrollView to the right

前端 未结 2 1463
野趣味
野趣味 2021-01-16 18:29

Everything is in the title; I want to programmatically scroll an NSScrollView to the right so I can see the end of my document.

I tried this :



        
相关标签:
2条回答
  • 2021-01-16 18:31

    Try

    let toRight = CGRect(x: width, y: 0, width: 0, height: height)
    scrollView.scrollRectToVisible(toRight)
    
    0 讨论(0)
  • 2021-01-16 18:54

    I finally got it to work by scrolling the content view :

    scrollView.contentView.scrollPoint(NSPoint(width, 0))
    
    0 讨论(0)
提交回复
热议问题