• 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
Doing NSStringDrawingTruncatesLastVisibleLine with NSLayoutManger
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Doing NSStringDrawingTruncatesLastVisibleLine with NSLayoutManger


  • Subject: Doing NSStringDrawingTruncatesLastVisibleLine with NSLayoutManger
  • From: Eric Gorr <email@hidden>
  • Date: Wed, 4 Mar 2009 16:57:28 -0500

I am drawing a string with a NSLayoutManager by doing:

[layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:NSMakePoint( [self bounds].origin.x,[self bounds].origin.y )];

What I would like is if the string I am drawing goes beyond the last visible line, is for the string to draw a truncated form of itself with an elipses at the last visible part of the string.

As near as I can tell, this is what the NSString drawing option NSStringDrawingTruncatesLastVisibleLine will do.

The paragraph style NSLineBreakByTruncatingTail comes close, but I have a single string that can be drawn over multiple lines and still be visible. The NSLineBreakByTruncatingTail style restrict my drawing to just a single line which isn't enough.

Anyone tried to emulate NSStringDrawingTruncatesLastVisibleLine with NSLayoutManager drawing?

Is there any sample code out there demonstrating the technique?




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Doing NSStringDrawingTruncatesLastVisibleLine with NSLayoutManger
      • From: Eric Gorr <email@hidden>
  • Prev by Date: Re: CoreData and NSUndoManager/Undo Grouping...
  • Next by Date: Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem (SOLVED)
  • Previous by thread: NSButton image drawn 1 pixel too high
  • Next by thread: Re: Doing NSStringDrawingTruncatesLastVisibleLine with NSLayoutManger
  • Index(es):
    • Date
    • Thread