Re: why don't custom views have a "tag" in IB?
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