• 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: changing the default color for text drawing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >changing the default color for text drawing (From: Kenny Leung <email@hidden>)

  • Prev by Date: Re: scrollRangeToVisible
  • Next by Date: Re: Scope variable pattern
  • Previous by thread: changing the default color for text drawing
  • Next by thread: Re: changing the default color for text drawing
  • Index(es):
    • Date
    • Thread