Re: change value for key in NSDictionary
Re: change value for key in NSDictionary
- Subject: Re: change value for key in NSDictionary
- From: Klaus Backert <email@hidden>
- Date: Mon, 23 Nov 2009 14:22:01 +0100
On 23 Nov 2009, at 13:33, Ariel Feinerman wrote:
Hi,
there is instance of NSDictionary to storage graphics attributes (full
screen, buffers` sizes, resolution),
my question is can I change value for, example, key "fullscreen"
somewhere in my progam?
From the NSDictionary Class Reference:
"An instance of NSDictionary is an immutable dictionary: you establish
its entries when it’s created and cannot modify them afterward. An
instance of NSMutableDictionary is a mutable dictionary: you can add
or delete entries at any time, and the object automatically allocates
memory as needed."
Use an NSMutableDictionary and invoke e.g.
[myMutableDictionary setObject: [NSNumber numberWithBool: fstate]
forKey: @"fullscreen"];
This replaces a previous entry with the same key.
Regards
Klaus
_______________________________________________
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:
This email sent to email@hidden