• 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: Displaying color code in stead of colored text?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Displaying color code in stead of colored text?


  • Subject: RE: Displaying color code in stead of colored text?
  • From: "Jonathan E. Jackel" <email@hidden>
  • Date: Mon, 24 Nov 2003 19:10:52 -0500

> NSColor *grey = [NSColor colorWithCalibratedRed:0.610 green:0.610
> blue:0.610 alpha:1.0];
>
> if ((![workAddr isEqualToString:@""])) {
> NSMutableAttributedString *aStr;
> aStr = [[[NSMutableAttributedString alloc]
> initWithString:[NSString stringWithFormat:@"%@ (work)",workAddr]]
> autorelease];
> [aStr
> addAttribute:NSForegroundColorAttributeName value:grey
> range:NSMakeRange([aStr length]-6,6)];
> [mDict setObject:[NSString
> stringWithFormat:@"%@\email@hidden",aStr] forKey:@"email"];
> }
>
> am i doing something wrong or is this a bug?
>
> is displaying: {}(home){ NSColor *grey = NSColor
> colorWithCalibratedRed:0.610 green:0.610 blue:0.610 alpha:1.0; }

You're doing something wrong.

Presumably you have a column in your table with an identifier "email", and
you are displaying the object in mDict for the key "email" in that column.
When you do:

[NSString stringWithFormat:@"%@\email@hidden",aStr]

You are putting the description of an attributed string into the new string.
The description includes information about the attributes, such as the
colors. What you want to do instead is append "\email@hidden" to aStr,
and put aStr in mDict.

Jonathan
_______________________________________________
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: 
 >Displaying color code in stead of colored text? (From: Chewtoy <email@hidden>)

  • Prev by Date: Re: cocoa-java
  • Next by Date: Re: cocoa-java
  • Previous by thread: Displaying color code in stead of colored text?
  • Next by thread: NSTableView reloadData not working?
  • Index(es):
    • Date
    • Thread