Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSAttributedString - NSDictionary



Hi All,


Im struggling to understand how *NSDictionary* works - more so with the
command listed below.


I am trying to output a large multicolored (color settings are user defined
and stored separately) NSString and I can't figure out how NSDictionary
stores and accesses its values when called up such that the right values are
picked up and coloured as per the user.

I'm using
*
*
initithString:attributes:
Returns an  NSAttributedString object initialized with a given string and
attributes.
- (id)initithString:(
NSString<http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/doc/c_ref/NSString>
 *)*aString* attributes:(
NSDictionary<http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/Reference/Reference.html#//apple_ref/doc/c_ref/NSDictionary>
 *)*attributes*

Do i use a separate dictionary describing the user color settings for
selected words or can one dictionary support this? For instance, I dont
think using the code below is sufficient for 3 different color settings for
3 different words as i feel newer settings overwrite the older ones. I am
currently using one dictionary to store colour values.

*

[dictionary setObject:[some color] forKey:NSForegroundColorAttributeName];

[dictionary setObject:[some color] forKey:NSBackgroundColorAttributeName];
*
Any help is much appreciated.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.