Created
September 14, 2010 21:41
-
-
Save NYiPhoneDeveloper/579826 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
int main (int argc, const char *argv[]) | |
{ | |
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; | |
NSMutableArray *collectionArray = [[NSMutableArray alloc] init]; | |
NSArray *numArray = [[NSArray alloc] init]; | |
NSArray *strArray = [[NSArray alloc] init]; | |
numArray = [NSArray arrayWithObjects: @"1", @"2", @"3", @"4", @"5", nil]; | |
strArray = [NSArray arrayWithObjects: @"One", @"Two", @"Three", @"Four", @"Five", nil]; | |
[collectionArray addObject: numArray]; | |
[collectionArray addObject: strArray]; | |
NSMutableDictionary *cD = [[NSMutableDictionary alloc] init]; | |
cD = [NSMutableDictionary dictionaryWithObjects: strArray forKeys: numArray]; | |
NSString *str = [cD objectForKey: @"1"]; | |
NSLog (@"%@\n", str); | |
[cD release]; | |
[strArray release]; | |
[numArray release]; | |
[pool drain]; | |
return 0; | |
} | |
/* | |
NSMutableDictionary *dOne = [[NSMutableDictionary alloc] init]; | |
dOne = [NSMutableDictionary dictionaryWithObjectsAndKeys: @"One", @"1", @"Two", @"2", @"Three", @"3", nil]; | |
NSString *myStr; | |
myStr = [dOne objectForKey: @"2"]; | |
NSLog (@"%@", myStr); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment