Re: changing the default color for text drawing
Re: changing the default color for text drawing
- Subject: Re: changing the default color for text drawing
- From: Sam Stigler <email@hidden>
- Date: Sat, 12 May 2007 01:46:38 +1000
This is completely untested, but maybe you could try creating an
NSMutableDictionary with all of the common attributes in it, then
only adding the ones you need each time, maybe to a different
dictionary. (For example...
NSMutableDictionary *commonAttributes = [NSMutableDictionary
dictionaryWithCapacity:10];
. . .
add all of the common attributes to commonAttributes
. . .
NSMutableDictionary *newAttributes = [NSDictionary
dictionaryWithDictionary:commonAttributes];
[newAttributes setObject:newValueforKey:@"background"];
etc., then use that new dictionary as your set of attributes for the
first string. Do roughly the same with the second string. Again,
completely untested, as you can tell.
-Sam
http://www.stigler.org/sam/wordpress
On May 12, 2007, at 1:28 AM, Kenny Leung wrote:
Hi All.
We are using NSAttributedString for drawing pretty complicated text
which sometimes has multiple colors. Now we find ourselves wanting
to draw the same text on different backgrounds, which means that we
want the default text color to be different. e.g. go from black
text on a white background to white text on a black background. Is
there a way to just change the default color that text is drawn in
without affecting the rest of the attributes? It would be very
onerous to go back and change everything so that we can specify the
default text color when these strings are created.
Thanks!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40mac.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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