Re: Animating autolayout constraint changes for subviews
Re: Animating autolayout constraint changes for subviews
- Subject: Re: Animating autolayout constraint changes for subviews
- From: Doug Hill <email@hidden>
- Date: Fri, 30 Dec 2016 11:50:03 -0800
> On Dec 30, 2016, at 11:38 AM, David Duncan <email@hidden> wrote:
>
>
>> On Dec 28, 2016, at 4:14 PM, Doug Hill <email@hidden> wrote:
>>
>> Hi Ken,
>>
>> The exact behavior is that the label will resize to the new size immediately and reflow the text, then the container view will animate it's size change. It would be nice if both the label and the container view animate at the same time.
>> Also, as I mentioned, a button will exhibit the same behavior, probably because it has a UILabel inside it to show the button text.
>
> Labels (and other content provided via -drawRect:) will almost universally behave this way without additional work on your part, as the content is redrawn instantly at the final size. At best you might get an animation where the content resizes into place, but more often than not, it will pop in some undesirable way. Generally the only way to get good animations with drawn content is to snapshot in some way and execute an custom animation from the old to the new content (snapshotting isn’t necessarily literal here – it can just mean creating a new label with the new content as one example).
David,
Thanks for the info. I’m curious what system views with content are animatable. I guess UIImageView works for the snapshots. But anything with a label is out. I’ll do some tests and see what works.
Doug Hill
_______________________________________________
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