id type in NSCoder
id type in NSCoder
- Subject: id type in NSCoder
- From: Ian McGregor <email@hidden>
- Date: Wed, 17 Dec 2003 22:30:16 -0800
I have a class which stores a set of titles/values.
@interface MyField : NSObject <NSCoding, NSCopying>
{
NSString *fieldName; // eg assetID
id fieldValue; // eg NSNumber, NSString,
NSCalendarDate
}
and this (which of course is not working because of the id fieldValue):
- (id)initWithCoder:(NSCoder *)coder
{
[super init];
[self setFieldName:[coder decodeObject]];
[self setFieldValue:[coder decodeObject]];
return self;
}
- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:[self fieldName]];
[coder encodeObject:[self fieldValue]];
}
any ideas on how I can make this class handle encoding and decoding
fieldValue?
I have been looking for examples on classForCoder and related, but have
not found very much.
Cheers,
Ian
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.