Re: Encoding a Custom Object which has a CALayer instance Variable (newbie Question)
Re: Encoding a Custom Object which has a CALayer instance Variable (newbie Question)
- Subject: Re: Encoding a Custom Object which has a CALayer instance Variable (newbie Question)
- From: Gustavo Pizano <email@hidden>
- Date: Sat, 13 Dec 2008 08:53:29 +0100
On 13.12.2008, at 6:16, Michael Ash wrote:
When you get to an object, you can simply encode it using [coder
encodeObject:obj forKey:@"key"]. Of course obj must implement NSCoding
as well, otherwise this will not work. For your own classes, you'll
need to implement NSCoding for everything that will get encoded.
CALayer already implements NSCoding so there's nothing tricky for that
one.
Mike
Aha, so I will need to do the following only:
-(void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeInt:size forKey:@"size"];
[coder encodeInt:impacts forKey:@"impacts"];
[coder encodeObject:shipImageLayer forKey:@"shipImageLayer"];
}
mmm Good
Thanks for your reply.
G
_______________________________________________
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