Re: Problem with NSLineBreakByTruncatingMiddle under 10.2
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