Re: animating an NSStackView
Re: animating an NSStackView
- Subject: Re: animating an NSStackView
- From: Ken Thomases <email@hidden>
- Date: Wed, 21 Jan 2015 00:38:01 -0600
On Jan 20, 2015, at 7:28 AM, Roland King <email@hidden> wrote:
> I'm trying to see if I can make insertions/deletions in an NSStackView a little more animated. So I did the simplest thing I could think of, wrapped the insert/delete in an NSAnimationContext, made the control layer-backed, turned on implicit animations and called layoutSubviewsIfNeeded. Something like this
>
> stackView.wantsLayer = YES;
> ...
> [ NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
> context.duration = somethingVeryLong;
> context.allowsImplicitAnimation = YES;
>
> [ stackView insertView:aNewView atIndex:aNewIndex ];
> [ stackView layoutSubviewsIfNeeded ]; // doesn't appear to be needed, also tried [ stackView.window layoutIfNeeded ]
> }
> completionHandler:NULL ];
Have you tried simply sending the -insertView:atIndex: message to the stack view's animator proxy, instead? (I have no particular reason to expect that it works better, just asking.)
Regards,
Ken
_______________________________________________
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