Re: encoding/decoding selectors?
Re: encoding/decoding selectors?
- Subject: Re: encoding/decoding selectors?
- From: Jean-Daniel Dupas <email@hidden>
- Date: Mon, 15 Dec 2008 15:02:12 +0100
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 (email@hidden)
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:
This email sent to email@hidden