• 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: Problem with NSLineBreakByTruncatingMiddle under 10.2
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with NSLineBreakByTruncatingMiddle under 10.2


  • Subject: Re: Problem with NSLineBreakByTruncatingMiddle under 10.2
  • From: Tim Hewett <email@hidden>
  • Date: Sat, 19 Feb 2005 22:06:41 +0000


On 19 Feb 2005, at 18:59, Roarke Lynch wrote:

On Feb 19, 2005, at 10:16 AM, Tim Hewett wrote:
This is how the NSParagraphStyle is created/initialised:

myDefaultStyle = [[NSMutableParagraphStyle alloc] retain];
myDefaultStyle setLineBreakMode:NSLineBreakByTruncatingMiddle]

I don't have a specific answer, but the code above doesn't look right. I'd replace the first line with:
myDefaultStyle = [NSMutableParagraphStyle defaultParagraphStyle];

I wish...

The call [NSMutableParagraphStyle defaultParagraphStyle] returns the
default paragraph style which is of type NSParagraphStyle, i.e. not
mutable. It is going to have to be of type NSMutableParagraphStyle if
the setLineBreak: method is going to work, an exception is generated
if you try to call this on a NSParagraphStyle object.

The "proper" way to do this has been found at
http://developer.apple.com/documentation/Cocoa/Conceptual/Rulers/Tasks/ TruncatingStrings.html
so the code has been changed to use the mutableCopy method to
create the NSMutableParagraphStyle object. Everything else is the
same compared to this sample code, in terms of how the attributed
string is created using the style etc..


Does this mean it works under 10.2 now? No. Still works great under
10.3, not 10.2 though.

Any suggestions as to how to get this going under 10.2 would be much
appreciated. There doesn't appear to be any actual example code which
uses this feature...

Regards,

Tim.

_______________________________________________
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


  • Follow-Ups:
    • Re: Problem with NSLineBreakByTruncatingMiddle under 10.2
      • From: Aki Inoue <email@hidden>
References: 
 >Problem with NSLineBreakByTruncatingMiddle under 10.2 (From: Tim Hewett <email@hidden>)
 >Re: Problem with NSLineBreakByTruncatingMiddle under 10.2 (From: Roarke Lynch <email@hidden>)

  • Prev by Date: Resetting screen saver preferences to default values
  • Next by Date: Re: Problem with NSLineBreakByTruncatingMiddle under 10.2
  • Previous by thread: Re: Problem with NSLineBreakByTruncatingMiddle under 10.2
  • Next by thread: Re: Problem with NSLineBreakByTruncatingMiddle under 10.2
  • Index(es):
    • Date
    • Thread