On Feb 25, 2010, at 2:59 PM, Dave Carrigan wrote:

On Feb 25, 2010, at 2:51 PM, Daniel Káčer wrote:

i need help with solution about store more complex values into NSDictionary.
I have following data which i need store in NSDictionary:

value1:@"A1" value2:@"B1" key:1
value1:@"A2" value2:@"B2" key:2
value1:@"A3" value2:@"B3" key:3
etc.

What is the ideal solution for this my case ?

Create a class to represent your complex values and store instances of that class in the dictionary.

Or, depending upon what you're trying to accomplish, you could also create a dictionary whose keys refer to other dictionaries.

NSMutableDictionary* dictionary = [NSMutableDictionary dictionary];

NSDictionary* dictionary1 = [NSDictionary dictionaryWithObjectsAndKeys:
                                @"A1", @"value1",
                                @"B1", @"value2",
                                nil];

[dictionary setObject:dictionary1 forKey:@"1"];
...

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to