Re: reestablishing IBOutlets from initWithCoder ?
Re: reestablishing IBOutlets from initWithCoder ?
- Subject: Re: reestablishing IBOutlets from initWithCoder ?
- From: Vince DeMarco <email@hidden>
- Date: Fri, 25 Jan 2002 09:55:55 -0800
On Friday, January 25, 2002, at 04:20 AM, Robert Miller wrote:
I have an application that allows archiving of a view for placement into
a
pasteboard. The view is loaded from a nib file and some of the views
subviews, (popup, button, etc.) have IBOutlets in the view that are
connected
in the nib. The problem is when the view (and its subviews) are archived
to
the pasteboard and then unarchived for pasting into some other view, the
IBOutlet connections that were connected from the view to its subviews are
lost. The unarchiving does not appear to reestablish any IBOutlet
connections.
Are you archiving all of the instance variables???
Vince DeMarco wrote:
On Thursday, January 24, 2002, at 01:29 PM, Robert Miller wrote:
Hello,
This is perhaps a rather unique scenario (then again maybe not but
I
haven't been able to figure it out). I have a custom view subclass of
NSView that has IBOutlets instance variables defined in it for things
like buttons and popup menus, and other views. When I archive /
unarchive the custom view everything gets restored properly except the
IBOutlet instance values. Since archiving an NSView handles the
archiving of its subviews some of which are my IBOutlet object
references I don't want to rearchive my IBOutlet instances. Is there
some clever way of reestablishing the IBOutlet connections when
unarchiving ? I've tried using tag values for some of the subviews and
that works by looking for the tag using 'viewWithTag' inside of my
initWithCoder override but that solution isn't the greatest since not
all cocoa objects provide a tag value in their inspector window. Any
ideas on how to reconnect IBOutlets from an unarchive operation ?
I don't understand what you are after. Interface Builder archives the
connections separately from the objects in the nib file.
For example NSButton "knows" how to archive references to its target and
action, but
IB doesn't let NSButton do the archiving, instead its done outside of the
object.
vince