Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSScrollView scroll position

I currently have a NSView in a NSScrollView. The NSView is large and I need to scroll to manage the object inside.

I want to draw a static rectangle in the center of the NSView without scrolling. I want to get the scrolling point (the NSClipPoint?) in the drawRect method of the NSView so that I can draw the rectangle at the last step of drawRect to make it on top.

I have looked through the doc and could only find methods to set the scroll point, not getting it. How can I get that point?

like image 415
mr.Pony Avatar asked Aug 19 '26 12:08

mr.Pony


1 Answers

The answer is [[myScrollView contentView] documentVisibleRect]

like image 166
mr.Pony Avatar answered Aug 23 '26 02:08

mr.Pony



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!