Re: How to compute optimal NSField size?
Re: How to compute optimal NSField size?
- Subject: Re: How to compute optimal NSField size?
- From: "I. Savant" <email@hidden>
- Date: Sun, 17 Jun 2007 16:26:10 -0400
On Jun 17, 2007, at 3:47 PM, Leon Starr wrote:
I am trying to figure out how to set the frame size of a field
based on the quantity of entered
text. Let's say the field can store a maximum of 40 characters,
but typically holds only 10-15
characters. If there is a small amount of text, I would like the
field frame to be the "small size".
But if the user enters 30 chars, I would like to resize the field
frame to the "big size".
In general, you could get the string value, then use the -
sizeWithAttributes: string method to figure out its size with the
field's attributes (font), or whatever attributes you want. Then you
can adjust the field's frame as needed.
--
I.S.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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