RE: Displaying color code in stead of colored text?
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.