• 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: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo


  • Subject: Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo
  • From: Dave <email@hidden>
  • Date: Wed, 27 Apr 2016 10:41:44 +0100

> On 27 Apr 2016, at 09:01, Martin Wierschin <email@hidden> wrote:
>
> 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
>


Yes, it was throwing but I didn’t notice it because of problem I’ve got with the Debugger catching exception breakpoints.

Cheers
Dave

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


References: 
 >How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo (From: Dave <email@hidden>)
 >Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo (From: Andreas Mayer <email@hidden>)
 >Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo (From: Dave <email@hidden>)
 >Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo (From: Bill Cheeseman <email@hidden>)
 >Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo (From: Dave <email@hidden>)
 >Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo (From: Bill Cheeseman <email@hidden>)
 >Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo (From: Dave <email@hidden>)
 >Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo (From: Bill Cheeseman <email@hidden>)
 >Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo (From: Dave <email@hidden>)
 >Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo (From: Dave <email@hidden>)
 >Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo (From: Martin Wierschin <email@hidden>)

  • Prev by Date: Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo
  • Next by Date: Can't code-signing validate an App's main executable, without its whole bundle.
  • Previous by thread: Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo
  • Next by thread: Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo
  • Index(es):
    • Date
    • Thread