• 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: String color
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: String color


  • Subject: Re: String color
  • From: John Hörnkvist <email@hidden>
  • Date: Wed, 19 Sep 2001 22:42:43 +0200

On Wednesday, September 19, 2001, at 08:38 PM, Mark Wridt wrote:
I cannot figure out or find code to change a string's
color.

I have a color set, but getting the string to be that
color is causing errors (mostly selector not
recognized)

My color code (that is working):

NSColor *color;
color = [[NSColor redColor] retain];

but

[aString setColor:color];
[aString textColor:color];
[aString setTextColor];
(as well as other crazy combinations)

all are not working.

NSStrings don't have color; use NSAttributedString if you want to set properties like color, font etc.

For simple drawing, the string should accept the graphics contex:
[[NSColor redColor] set];
[string drawAtPoint:NSMakePoint(10,10)];

Regards,
John Hornkvist
--
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com


  • Follow-Ups:
    • Re: String color
      • From: Ondra Cada <email@hidden>
References: 
 >String color (From: Mark Wridt <email@hidden>)

  • Prev by Date: String color
  • Next by Date: Re: String color
  • Previous by thread: String color
  • Next by thread: Re: String color
  • Index(es):
    • Date
    • Thread