Re: NSScrollView animation (animate scroll point)
Re: NSScrollView animation (animate scroll point)
- Subject: Re: NSScrollView animation (animate scroll point)
- From: Daniel Vollmer <email@hidden>
- Date: Fri, 02 Sep 2011 12:37:51 +0200
'lo,
On 2 Sep 2011, at 06:54, Indragie Karunaratne wrote:
> This has been asked a few times before, but not after Lion was released so I figured I'd ask again. Is there any way to animate the scroll point of an NSScrollView? I figure that animation must be possible somehow, considering that inertial scrolling is basically animating the scroll point. I expected to see new API's in Lion for this, but there seems to be nothing that was added to NSScrollView that would enable me to easily do this. The only way that comes to mind is to use an NSTimer to create an animation of sorts, but I imagine that this wouldn't perform too well and that it wouldn't look very smooth either.
You can simply animate the bounds-rectangle of the scrollview's clipview, e.g.
[NSAnimationContext beginGrouping];
NSClipView* clipView = [[_myView enclosingScrollView] contentView];
NSPoint newOrigin = [clipView bounds].origin;
newOrigin.x = MY_NEW_POSITION;
[[clipView animator] setBoundsOrigin:newOrigin];
[NSAnimationContext endGrouping];
Daniel._______________________________________________
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