Re: Bounding rect for String when wrapped
Re: Bounding rect for String when wrapped
- Subject: Re: Bounding rect for String when wrapped
- From: Matt Neuburg <email@hidden>
- Date: Wed, 11 Sep 2002 08:34:56 -0700
On Wed, 11 Sep 2002 01:36:53 EDT, email@hidden said:
>
For my utility, I need to draw a series of Strings in columns of a fixed
>
with, with word wrapping; I do not want to lose any text or words.
>
>
Some of the Strings will be long and wrap to more than one lines do to
>
horizontal constraints, while others will have one or more returns (ie. line
>
feeds/carriage returns) in them, so they would always take up more than one
>
line.
>
>
I can use drawInRect:withAtrributes: to draw the String in a given rectangle
>
with word wrapping, but first I need to calculate the rectangle. I know the
>
width, but am having problems calculating the height.
What I do is call -sizeToFit and then look to see what the height is.
Perhaps this is somewhat crude and not the right way, but it works great. m.
--
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.