Re: Alternate to scrollPoint?
Re: Alternate to scrollPoint?
- Subject: Re: Alternate to scrollPoint?
- From: Kyle Sluder <email@hidden>
- Date: Tue, 24 Sep 2013 06:25:06 -0700
> On Sep 23, 2013, at 3:02 PM, Steve Mills <email@hidden> wrote:
>
> We have a situation where we want to call scrollPoint on our view that's in a scroll view. It appears that scrollPoint does not immediately cause the scroll to happen. Right after we call scrollPoint, we need to ask the view for its new scroll location to see if it actually changed. At this point, it has not scrolled yet, so it breaks this code that used to work in Carbon.
Yeah, NSScrollView animations are annoying and unpredictable. Is suggest filing a radar asking for better control over and feedback about them.
>
> It appears that scrollPoint is causing an animation to be queued, even though we tried to disable it like so:
>
> [CATransaction begin];
> [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
> [CATransaction setAnimationDuration:0];
> [view scrollPoint:pos];
> [CATransaction commit];
Did you try wrapping your call to -scrollPoint: in an NSAnimationContext with allowsImplicitAnimation=NO?
>
> The animation is in our way. I found a workaround that seems to work, which is to simply call this instead of all that:
>
> [[[view enclosingScrollView] contentView] setBoundsOrigin:pos];
>
> Is this a viable workaround? Can anyone foresee any problems with it? Is there a better way to make scrollPoint work *right now*?
Since scrolling is defined to be performed by translating the bounds.origin of the clip view, this should be fine. But I wonder if it will interfere with your previously mentioned pseudo-scrolling (which would be another reason to abandon that approach and adopt one that doesn't fight the framework).
--Kyle Sluder
_______________________________________________
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