Re: NSCell Text Alignment
Re: NSCell Text Alignment
- Subject: Re: NSCell Text Alignment
- From: Keith Renz <email@hidden>
- Date: Thu, 14 Oct 2004 11:03:31 -0400
Daniel,
To get similar behavior (truncate end), my table view data source
returns an attributed string whose paragraph line break mode is set to
NSLineBreakByTruncatingTail (you'll want to use
NSLineBreakByTruncatingMiddle).
- (NSAttributedString *)myDescription
{
// String
NSString *string = [NSString stringWithFormat:@"%i %@", num, [self
stringFromRamp:ramp]];
// Attributes
NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc]
init];
[paragraph setLineBreakMode:NSLineBreakByTruncatingTail];
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
paragraph, NSParagraphStyleAttributeName, nil];
[paragraph release]; // Clean-up.
// Return an autoreleased attributed string.
return [[[NSAttributedString alloc] initWithString:string
attributes:attributes] autorelease];
}
This may be 10.3 and greater only -- can't remember.
Keith
_______________________________________________
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