Re: Unarchiving a plugin custom control
Re: Unarchiving a plugin custom control
- Subject: Re: Unarchiving a plugin custom control
- From: Fritz Anderson <email@hidden>
- Date: Mon, 21 Jul 2008 12:47:28 -0500
On 20 Jul 2008, at 9:05 PM, Anders Lassen wrote:
I am working on a custom control, which has a few simple properties.
The object is a subclass of NSBox, and is therefore initialized with
initWithCoder.
When the object is created for the first time and nothing has been
saved to the archive, all properties are set to zero values.
My problem is that I would like to bypass the decoding when the
achive is "empty", and assign other default values (than zero).
I wonder whether this is possible?
I assume you have a class for some sort of controller object (whether
an NSDocument, or NSWindowController, or just an NSObject subclass of
your own) that serves as the "owner" of the NIB in question.
Make sure that owner object has an IBOutlet that points to your NSBox-
subclass object. In Interface Builder, hook the box object to that
outlet in File's Owner. (You will have to set File's Owner's class, so
IB will know the outlet exists.)
When the NIB is loaded, the loading system will send -awakeFromNib to
the owner object. All your connections will have been set up then, and
because you've hooked your custom view to an outlet of your owner
object, you have direct access to it. You can then initialize your
view according to the content of the document.
— F
_______________________________________________
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