Skip to content

Instantly share code, notes, and snippets.

@akio0911
Created May 22, 2009 07:58
Show Gist options
  • Save akio0911/116009 to your computer and use it in GitHub Desktop.
Save akio0911/116009 to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
int main() {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSArray *keys = [NSArray arrayWithObjects:@"key1", @"key2", @"key3", nil];
NSArray *objects = [NSArray arrayWithObjects:@"value1", @"value2", @"value3", nil];
NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObjects:objects forKeys:keys];
for(id key in dictionary){
NSLog(@"key: %@, value: %@", key, [dictionary objectForKey:key]);
}
id anObject = [[dictionary objectForKey:@"key2"] retain];
[dictionary removeObjectForKey:@"key2"];
NSLog(@"%@", dictionary);
[pool release];
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment