Re: iTunes-like tail truncation for attributed strings
Re: iTunes-like tail truncation for attributed strings
- Subject: Re: iTunes-like tail truncation for attributed strings
- From: Steve Cronin <email@hidden>
- Date: Mon, 12 Jan 2009 07:20:11 -0600
BK;
Thanks!! Bingo!
The key for me:
"...The behavior can be controlled with -truncatesLastVisibleLine for
text cells..." This is a checkbox in IB, at the text cell inside the
tableColumn.
This in conjunction with the LineBreaks: truncatesTail setting
I did NOT have to make any changes to the attributed string which
simply specifies an baseline offset and the image
(attrStringWithAttachement)
God Bless Cocoa!
Steve
On Jan 12, 2009, at 7:08 AM, Buddy Kurz wrote:
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