• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bounding rect for String when wrapped
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • RE: Bounding rect for String when wrapped
      • From: "Jonathan E. Jackel" <email@hidden>
  • Prev by Date: Re: Validating NSControl
  • Next by Date: argh...linking problems with AppleShare client lib
  • Previous by thread: Bounding rect for String when wrapped
  • Next by thread: RE: Bounding rect for String when wrapped
  • Index(es):
    • Date
    • Thread