Re: Smooth resizing of a text field
Re: Smooth resizing of a text field
- Subject: Re: Smooth resizing of a text field
- From: Duncan Champney <email@hidden>
- Date: Fri, 05 Aug 2011 16:11:29 -0400
On 20 Jul 2011, at 2:30 PM, Gabriel Roth wrote:
> Subject: Smooth resizing of a text field
> Date: July 20, 2011 3:30:56 PM EDT
> To: email@hidden
>
>
> My application displays a non-editable text string in an NSTextField. When
> the user adjusts a slider, the entire window and all its subviews—including
> this text field—should resize smoothly.
>
> My first thought was to bind the font size of the text field to a property
> and have that property set to a fixed ratio of the window's size, resetting
> it whenever the window size changes. But when I implement this, the text
> jiggles around as it's resized.
>
> My next thought was to convert the text field into an image (at some large
> font size) and then scale the image up and down as the slider moves. But I
> can't figure out how to create an image from a text field (or otherwise
> generate an image of a string of text in a given font).
>
> Any thoughts on what avenue to pursue would be much appreciated.
>
> gr.
This sounds tailor-made for Core Animation.
Figure out which field(s) need to be resized.
The use code like this:
myTextField.wantsLayer = TRUE; //Set up a CA Layer for this field.
myTextField.animator _______________________________________________
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