views:

371

answers:

3

How can I store a UIImage in an NSDictionary?

+1  A: 

[dictionary setObject:yourImage forKey:@"whatever key you want"];

Untested ;-)

MrMage
+1  A: 

[dict setObject:image forKey:@"ImageToStore"];

Joe Cannatti
+2  A: 

Yes you can:

NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:1];
UIImage *img = ...;
[dict setObject:img forKey:@"aKeyForYourImage"];

UIImage *imgAgain = [dict objectForKey:@"aKeyForYourImage"];
Felix