Le 15 déc. 08 à 14:47, Karan, Cem (Civ, ARL/CISD) a écrit :
I need to encode/decode an object which has a selector as one of its
instance variables. I know that NSCoder doesn't directly support
this, so my current way of doing things is the following:
- (void) encodeWithCoder:(NSCoder *) aCoder
{
[aCoder encodeObject:NSStringFromSelector(self.selector)
forKey:@"selector"];
}
- (id) initWithCoder:(NSCoder *)aDecoder
{
self.selector = NSSelectorFromString([aDecoder
decodeObjectForKey:@"selector"]);
}
Is this the correct method?
Thanks,
Cem Karan
Look fine. I think this is the way to go.
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com