Re: simple CATextLayer scaling problem
Re: simple CATextLayer scaling problem
- Subject: Re: simple CATextLayer scaling problem
- From: douglas welton <email@hidden>
- Date: Mon, 10 May 2010 18:45:48 -0400
Julian,
<untested speculation>
I would suggest that you use KVO to observe the value of the bounds property of your layer. When you are notified of the property change, compute the new size for your font at that point.
you may be able to do this rather easily by setting the layers needsDisplayOnBoundsChange property to YES. This should trigger a call to the layer's delegate with a -drawLayer:inContext message (where you can compute the font size as needed).
Alternately, you may be able to use the -actionForLayer: delegate message as well. I'm not sure if there is an action for bounds change, but it's worth a check.
</untested speculation>
later,
douglas
On May 10, 2010, at 4:25 AM, Julian. wrote:
> Have to say, that i'm new to cocoa and even newer to core animation. i have tried so far, bit trail&errorly: CAConstraint, autoresizingMask, preferredFrameSize and googled for the problem. I know, newbie questions suck :)
>
> lg, Julian.
>
>
> Am 10.05.2010 um 04:33 schrieb Kyle Sluder:
>
>> On May 9, 2010, at 2:44 AM, "Julian." <email@hidden> wrote:
>>
>>> I'm having a simple scaling problem with CATextLayer, but i just couldn't figure it out:
>>> I want the CATextLayer to proportionally grow in size with it's superlayer:
>>> if the superlayer's width is 300 the text size of CATextLayer should be 12 and if the supeview's width is 600 the text size should be 24.
>>> I couldn't find a working solution!
>>>
>>
>> What have you tried so far, and how has it failed you?
>>
>> http://www.whathaveyoutried.com
>>
>> --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
_______________________________________________
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