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

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


  • Subject: Truncating a string with ellipses in a multi-line drawInRect: operation?
  • From: Keith Blount <email@hidden>
  • Date: Sun, 19 Feb 2006 10:25:28 -0800 (PST)

Hello,

I have a view that draws lots of rectangles of text to
look like index cards. To draw the main block of text
for each card, I'm using NSString's
-drawInRect:withAttributes:. However, I would like to
make it so that if the text is too long to fit into
the index card, the last visible line is truncated to
display an ellipsis at its end.

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. 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.

Does anybody have any ideas of how I would go about
this?

Many thanks in advance for any suggestions,
Keith

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
 _______________________________________________
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

  • Follow-Ups:
    • Re: Truncating a string with ellipses in a multi-line drawInRect: operation?
      • From: Uli Kusterer <email@hidden>
  • Prev by Date: Re: NSDrawer bug in interface builder?
  • Next by Date: Re: NSSearchField (configuring cancel action)
  • Previous by thread: NSSearchField latency and performance (was: configuring cancel action)
  • Next by thread: Re: Truncating a string with ellipses in a multi-line drawInRect: operation?
  • Index(es):
    • Date
    • Thread