• 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: Custom Outline
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom Outline


  • Subject: Re: Custom Outline
  • From: Jerry Krinock <email@hidden>
  • Date: Fri, 25 Nov 2005 10:46:07 -0800
  • Thread-topic: Custom Outline

on 05/11/25 02:02, email@hidden at
email@hidden wrote:

> But when I edit a cell which has text longer than the column, I'd like to
> scroll the text in order to display the end of the text and not the
> beginning.
> Right now, it displays and select the beginning.


> Guillaume

Yes, I think I lost some hair scratching my head over something similar a
few months ago.  This might be what you want.  It is a "category" method
I've added to NSString which returns an attributed string truncated to a
desired width:

- (NSAttributedString *)asAttributedStringTruncatedToWidth:(float)width
{
    NSMutableString* text = [self mutableCopy];
    NSAttributedString* s = [NSAttributedString alloc];
    NSMutableParagraphStyle *ps = [[NSParagraphStyle defaultParagraphStyle]
mutableCopy];
    [ps setLineBreakMode: NSLineBreakByTruncatingHead];
    s = [s initWithString: text attributes:[NSDictionary
dictionaryWithObjectsAndKeys:
                    ps, NSParagraphStyleAttributeName, nil]];
    [text release];
    [ps release];
    return [s autorelease];
}



 _______________________________________________
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: 
 >Custom Outline (From: email@hidden)

  • Prev by Date: Re: Is Apple's singleton sample code correct?
  • Next by Date: Binding question
  • Previous by thread: Custom Outline
  • Next by thread: Another Newbie's Insights to cross the Usual Stumbling Blocks Re: Newbie needs help with tableview and bindings
  • Index(es):
    • Date
    • Thread