scrollToPoint vs scrollRectToVisible
scrollToPoint vs scrollRectToVisible
- Subject: scrollToPoint vs scrollRectToVisible
- From: Tim Conkling <email@hidden>
- Date: Wed, 22 Sep 2004 02:19:34 -0400
I have a custom document view class (subclassing off NSView) that's
embedded in an NSScrollView. When a new document was selected for
display in the view, I was doing the following:
[(NSClipView *)[self superview] scrollToPoint:topLeft];
to scroll the view to the top-left corner of the document. However,
this was making the view act very screwy (the view's contents would be
erased and the scroll bar would not move to its correct location).
After looking at the Cocoa docs for a long time, I decided to try
replacing the above line with this:
[self scrollRectToVisible:topLeftRect];
This fixed my problem. However, I don't understand why it worked.
Apple's docs on scrollRectToVisible: say that the method "Scrolls the
receiver’s closest ancestor NSClipView the minimum distance needed so
aRect in the receiver becomes visible in the NSClipView." This sounds
to me like it does exactly what my original code was doing. What am I
missing here?
Thanks,
Tim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden