I need to store multiple values in an NSDictionary, I've discovered that you can use a container class, see this link.
http://www.cocoabuilder.com/archive/cocoa/282022-store-more-complex-values-into-nsdictionary.html
Heres an example container class
Heres the code I would normally use to add one value to an NSDictionary.
I realise I'd need to use setObject instead of setValue.
I've read that id can be used for any type of object, however I'm not sure how to use the container class with an NSDictionary and how to add the values to it.
I really need some kind person to provide me with an example.
Many thanks in advance.
http://www.cocoabuilder.com/archive/cocoa/282022-store-more-complex-values-into-nsdictionary.html
Heres an example container class
Code:
@interface My_Pair : NSObject
{
id first;
id second;
}
+ (My_Pair *)pairWith:(id)_first and:(id)_second;
- (id)initWith:(id)_first and:(id)_second;
- (id)first;
- (id)second;
@end
Heres the code I would normally use to add one value to an NSDictionary.
Code:
NSMutableDictionary *dictResult = [[[NSMutableDictionary alloc] init] retain];
[dictResult setValue:sWavResult forKey:@"sWav"];
I realise I'd need to use setObject instead of setValue.
I've read that id can be used for any type of object, however I'm not sure how to use the container class with an NSDictionary and how to add the values to it.
I really need some kind person to provide me with an example.
Many thanks in advance.