Re: Space Required By Text
Re: Space Required By Text
- Subject: Re: Space Required By Text
- From: David Remahl <email@hidden>
- Date: Wed, 30 May 2001 20:44:07 +0200
I have a text, which I would like to display in a text field. I would
like to size the text field on run time to fit exactly the text. The
text is line-broken by hard breaks, and occupies many lines, and
approximately 80 columns. I would like to know the rect in which the
text exactly fits using my font attributes.
Look into -sizeWithAttributes in NSString Additions!
Off the top of my head, something like:
int textWidth;
textWidth = [@"your string" sizeWithAttributes:yourDict].width;
would suffice!
No, actually it would not...I really do need the full rect, including
the height of the text...
Thanks anyway!
/ david