NSScrollView scrollToTop

后端 未结 4 1527
一向
一向 2021-02-14 16:55

Does anyone know the correct way to scroll the NSScrollView to the top? I was looking for an equivalent to the UIView\'s scrollToTop method.

This is what I have so far,

4条回答
  •  一生所求
    2021-02-14 17:52

    The previous solutions scroll to the bottom when translating to Swift for Mac OS. The y coordinate direction is flipped on Mac OS and iOS.

    Swift 3 Solution for Mac OS:

    scrollView.documentView?.scroll(NSPoint.zero)
    

提交回复
热议问题