• 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: Applying text attributes in Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applying text attributes in Cocoa


  • Subject: Re: Applying text attributes in Cocoa
  • From: Jörn Salewski <email@hidden>
  • Date: Wed, 20 Aug 2003 23:59:02 +0200

If your theTextView is an NSTextView, then it should be [[theTextView
textStorage] setAttributedString: attrString];

JS

am 20.08.2003 23:18 Uhr schrieb Michael Hanna unter email@hidden:

> I'm having trouble applying two text attributes to a string: a font and
> I want it such that the gap between lines gets compressed;not sure if I
> should alter LineSpacing or NSBaselineOffsetAttributeName in a
> NSTextStorage object.
>
> here's my go at it:
>
> [...]
>
> mySongString = [[NSString alloc] initWithString:[song
> theSongAsString]];
>
> bodyFont = [NSFont fontWithName:@"Zapfino" size:10];
> theStyle =[[NSMutableParagraphStyle alloc] init];
> [theStyle setLineSpacing:0.0];
>
> NSDictionary * attr = [NSDictionary dictionaryWithObject:theStyle
> forKey:NSParagraphStyleAttributeName];
>
> attrString = [[NSAttributedString alloc]
> initWithString:mySongString attributes:attr];
>
> [theTextView setFont:bodyFont];
> [theTextView setStringValue:attrString]; // warning: passing arg 1
> of `setStringValue:' from incompatible pointer type
>
> so the object I'm passing is incompatible..so what's the best way to go
> about this?
>
> Michael
> _______________________________________________
> cocoa-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Applying text attributes in Cocoa (From: Michael Hanna <email@hidden>)

  • Prev by Date: Simple question: Why does this work?
  • Next by Date: Re: Applying text attributes in Cocoa
  • Previous by thread: Applying text attributes in Cocoa
  • Next by thread: Re: Applying text attributes in Cocoa
  • Index(es):
    • Date
    • Thread