FROM : Keith Renz
DATE : Thu Oct 14 17:03:31 2004
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
DATE : Thu Oct 14 17:03:31 2004
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
| Related mails | Author | Date |
|---|---|---|
| Daniel Todd Currie | Oct 14, 04:29 | |
| Daniel Todd Currie | Oct 14, 04:48 | |
| Daniel Todd Currie | Oct 14, 06:03 | |
| Keith Renz | Oct 14, 17:03 |






Cocoa mail archive

