• 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: why don't custom views have a "tag" in IB?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why don't custom views have a "tag" in IB?


  • Subject: Re: why don't custom views have a "tag" in IB?
  • From: James Bucanek <email@hidden>
  • Date: Tue, 21 Nov 2006 18:37:49 -0700

Matt Neuburg wrote on Tuesday, November 21, 2006:
>Still, as I said before, in this case, this fact does me no good, because if
>I copy the NSView by archiving it into an NSData and unarchiving it, the
>outlet is lost - it is nil, and therefore unusable, in the unarchived copy.

I hesitated answering that statement earlier, because I wasn't sure by what you meant when you said "archiving."

If you have created a custom subclass of NSView, and your class has instance variables that you want to preserve when archiving (encoding/ecode), then your class must conform to the NSCoder protocol and implement (or override) -(void)encodeWithCoder:(NSCoder*)encoder and -(id)initWithCoder:(NSCoder*)decoder. The coders defined by NSView have no knowledge of your instance variables, so these will be lost unless you add code to archive and restore them.

See <file:///Developer/ADC Reference Library/documentation/Cocoa/Conceptual/Archiving/index.html#//apple_ref/doc/uid/10000047i>

Note that this is strictly a Cocoa question and not an Xcode question. You can get lots of help with NSCoder on the Cocoa-dev list.


James Bucanek
____________________________________________________________________
Author of Beginning Xcode                           ISBN: 047175479X
<http://www.beginningxcode.com/>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: why don't custom views have a "tag" in IB? (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: why don't custom views have a "tag" in IB?
  • Next by Date: Re: Targets and include files..
  • Previous by thread: Re: why don't custom views have a "tag" in IB?
  • Next by thread: Re: why don't custom views have a "tag" in IB?
  • Index(es):
    • Date
    • Thread