NSDictionary with key => String and Value => c-Style array

Posted by Gautam Borad on Stack Overflow See other posts from Stack Overflow or by Gautam Borad
Published on 2010-04-17T06:44:27Z Indexed on 2010/04/17 6:53 UTC
Read the original article Hit count: 637

Filed under:
|
|

I need an NSDictionary which has key in the form of string (@"key1", @"key2") and value in the form of a C-style two-dimentional array (valueArray1,valueArray2) where valueArray1 is defined as :

int valueArray1[8][3] = { {25,10,65},{50,30,75},{60,45,80},{75,60,10},
                          {10,70,80},{90,30,80},{20,15,90},{20,20,15} };

And same for valueArray2.

My aim is given an NSString i need to fetch the corresponding two-dimentional array. I guess using an NSArray, instead of c-style array, will work but then i cannot initialize the arrays as done above (i have many such arrays). If, however, that is doable please let me know how.

Currently the following is giving a warning "Passing argument 1 of 'dictionaryWithObjectsAndKeys:' from incompatible pointer type" :

NSDictionary *myDict = [NSDictionary dictionaryWithObjectsAndKeys:valueArray1,@"key1",
                    valueArray2,@"key2",nil];

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about nsdictionary