NSScrollView scrollToTop

后端 未结 4 1515
一向
一向 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:53

    This also works fine. Set scroll point of documentView of NSScrollView

    NSPoint pt = NSMakePoint(0.0, [[self.scrollView documentView]
                                   bounds].size.height);
    [self.scrollView.documentView scrollPoint:pt];
    

提交回复
热议问题