• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Encoding a Custom Object which has a CALayer instance Variable (newbie Question)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Encoding a Custom Object which has a CALayer instance Variable (newbie Question) (From: Gustavo Pizano <email@hidden>)
 >Re: Encoding a Custom Object which has a CALayer instance Variable (newbie Question) (From: "Michael Ash" <email@hidden>)

  • Prev by Date: Re: how to let the NSOutlineview to display the line number?
  • Next by Date: Re: Trying To Understand Bindings
  • Previous by thread: Re: Encoding a Custom Object which has a CALayer instance Variable (newbie Question)
  • Next by thread: Re: Encoding a Custom Object which has a CALayer instance Variable (newbie Question)
  • Index(es):
    • Date
    • Thread