• 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: iTunes-like tail truncation for attributed strings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iTunes-like tail truncation for attributed strings


  • Subject: Re: iTunes-like tail truncation for attributed strings
  • From: Buddy Kurz <email@hidden>
  • Date: Mon, 12 Jan 2009 05:08:37 -0800

I found these in my email archive...

NSString *stringToDraw; // the string to draw
NSMutableDictionary *attrs = [NSMutableDictionary dictionaryWithCapacity:2];
NSMutableParagraphStyle *ps = [[[NSMutableParagraphStyle alloc] init] autorelease];
[ps setLineBreakMode:NSLineBreakByTruncatingTail];
[attrs setObject:ps forKey:NSParagraphStyleAttributeName];
[stringToDraw drawInRect:rect withAttributes:attrs];


"The Cocoa Text System now allows the last visible line to have an ellipsis character appended if the entire content cannot fit into the specified bounding box. The behavior can be controlled with - truncatesLastVisibleLine for text cells. The -lineBreakMode must be either NSLineBreakByWordWrapping or NSLineBreakByCharWrapping for this option to take effect.. Also, the NSStringDrawingTruncatesLastVisibleLine flag can be specified to NSStringDrawing APIs that take NSStringDrawingOptions. The NSStringDrawingUsesLineFragmentOrigin flag must also be specified for the truncation flag to take effect."

Maybe this will point you in the right direction

bk



On Jan 12, 2009, at 12:19 AM, Steve Cronin wrote:

Folks;

I have a source list type view.
I am using a tableView not an outlineView because it works for this data set.
I have an attributed string which has an image and a name.
This is the only column in this tableView.
This tableView is contained in a splitView which allows this 'nav' to be re-sized....


A lot of words to describe something quite similar to iTunes.
As you reduce iTunes playlist column size toward its minimum, the playlists do a 'tail truncation' on any long text.


How do I achieve that?
What I am seeing regardless of many different settings, is that the text 'breaks' at the space between the image and wraps to a a second line.
I have Truncate Tail set in the Text Field Cell for the table column.


Can you achieve this with effect with IB and an attributed string or is some other code solution necessary?

Thanks for any help!
Steve
_______________________________________________

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

_______________________________________________

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: iTunes-like tail truncation for attributed strings
      • From: Steve Cronin <email@hidden>
References: 
 >iTunes-like tail truncation for attributed strings (From: Steve Cronin <email@hidden>)

  • Prev by Date: Dynamically register document types
  • Next by Date: Help on player application
  • Previous by thread: iTunes-like tail truncation for attributed strings
  • Next by thread: Re: iTunes-like tail truncation for attributed strings
  • Index(es):
    • Date
    • Thread