• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
scrollToPoint vs scrollRectToVisible
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: scrollToPoint vs scrollRectToVisible
      • From: Allan Odgaard <email@hidden>
  • Prev by Date: Re: Scripting support problems
  • Next by Date: Re: Broken BoingX demo?
  • Previous by thread: Re: Newbie question: how to release an object that has been autoreleased
  • Next by thread: Re: scrollToPoint vs scrollRectToVisible
  • Index(es):
    • Date
    • Thread