This code is never going to work:

> [[myTextView textStorage] addAttribute:NSParagraphStyleAttributeName 
> value:[NSNumber numberWithInt:NSLineBreakByTruncatingTail] range:myRange];
> 
> But this results in nothing being displayed in the ScrollView/TextView.

In fact, using that code probably threw at least one exception, which is why 
you're not seeing anything in your text view.

The NSParagraphStyleAttributeName attribute expects a NSParagraphStyle object 
as its value, not an NSNumber. The value you're trying to set (the line 
breaking mode) is a property of the paragraph style. You want code that 
resembles:

        NSMutableParagraphStyle* paraStyle = [[NSMutableParagraphStyle alloc] 
init];
        [paraStyle setLineBreakMode:NSLineBreakByTruncatingTail];
        [textStorage addAttribute:NSParagraphStyleAttributeName value:paraStyle 
range:myRange];

That's typed into Mail and may have errors, but you get the idea.

~Martin Wierschin

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to