• 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: Truncating a string with ellipses in a multi-line drawInRect: operation?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Truncating a string with ellipses in a multi-line drawInRect: operation?


  • Subject: Re: Truncating a string with ellipses in a multi-line drawInRect: operation?
  • From: Uli Kusterer <email@hidden>
  • Date: Sun, 19 Feb 2006 21:08:44 +0100

Am 19.02.2006 um 19:25 schrieb Keith Blount:
Obviously this is very easy to do when drawing only a
single line, as you can just set
NSLineBreakByTruncatingTail for the line break mode of
the paragraph style.

Note that this option didn't really work in 10.2 (maybe even 10.3 ... not sure anymore). What we did back in those days was to keep truncating the string until it was short enough to fit its box. This approach could come in handy for you as well...


The problem is that I want my
text to wrap to fill the rectangle, and then only have
the last line truncated with an ellipsis - setting the
line break mode confines the whole text to one line.

I think there's a way to find out the baseline offset of a line in an NSTextView or a text field cell. I'd personally try just using one of those, finding out the range of the last line and then truncating that line until it fits. Sorry that I'm so low on the details...


Cheers,
-- M. Uli Kusterer
http://www.zathras.de


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Truncating a string with ellipses in a multi-line drawInRect: operation? (From: Keith Blount <email@hidden>)

  • Prev by Date: Questions about NSThread, NSRunloop, Webview
  • Next by Date: Re: Questions about NSThread, NSRunloop, Webview
  • Previous by thread: Truncating a string with ellipses in a multi-line drawInRect: operation?
  • Next by thread: Questions about NSThread, NSRunloop, Webview
  • Index(es):
    • Date
    • Thread