Re: Hot can I get called when my view scrolls?
Re: Hot can I get called when my view scrolls?
- Subject: Re: Hot can I get called when my view scrolls?
- From: Quincey Morris <email@hidden>
- Date: Wed, 06 Apr 2011 21:28:17 -0700
On Apr 6, 2011, at 21:06, Carlos Eduardo Mello wrote:
> I have a custom view embeded in a scroll view (let's call it View A). I have another view (View B) which is related to View A (but not inside it) and needs to be updated whenever view A scrolls. (Please note that I don't have any problems with scrolling. Scrolling works great in View A)
>
> I know how to actively query the scroll view for scroller positions ( [ [ scrollView verticalScroller ] floatValue ] ), or for the clip view position ( [ [ scrollView contentView] bounds ].origin; ), but how do I act on continuous scrolling actions initiated by the user?
View B should observe view A's clip view bounds change notifications (and you have to enable posting of the notifications -- see NSView documentation).
View A's frame coordinates are in the bounds coordinate system of its superview, the clip view (which in turn has the scroll view as its superview). To scroll its subview, the clip view offsets its own bounds to "place" itself over the portion of the subview that should be visible.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden