Re: Truncating a string with ellipses in a multi-line drawInRect: operation?
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