• 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: NSCell Text Alignment
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >NSCell Text Alignment (From: Daniel Todd Currie <email@hidden>)
 >Re: NSCell Text Alignment (From: Daniel Todd Currie <email@hidden>)

  • Prev by Date: Re: NSWindowController usage question
  • Next by Date: Does Apple support the GSM610 Codec?
  • Previous by thread: Re: NSCell Text Alignment
  • Next by thread: [[webView mainFrame] loadHTMLString:theValue baseURL:nil] ?
  • Index(es):
    • Date
    • Thread