Re: Loading Nibs which are self-ref
Re: Loading Nibs which are self-ref
- Subject: Re: Loading Nibs which are self-ref
- From: Jens Alfke <email@hidden>
- Date: Thu, 07 Jul 2011 14:36:32 -0700
On Jul 7, 2011, at 12:45 PM, Kevin Muldoon wrote:
> Can I (or should I) hook up File's Owner as I would a subclass of NSWindowController? Thereby skipping creating a new object->subclassing as SecondWindow? That seems 'right'. That nicely separates my code from my UI, making it (bit) more portable, but may be contributing to unresponsive behavior.
I’m sorry, I don’t understand what you’re asking. The class of the Files’ Owner object should be set to your NSWindowController subclass. You don’t add any custom object to the nib for the window controller.
The “File’s Owner” pseudo-object in the nib is a placeholder for the pre-existing object specified as the owner when the nib is loaded; it’s not an object loaded by the nib. The purpose of that object is so that outlets in that object can be hooked up, and so objects from the nib can be pointed at it.
> For instance...This code will update NSTextField with text...
>
> secondWindow = [[SecondWindow alloc] init];
> [secondWindow setStringValueOfMyTextField:@"Hello! I am SecondWindow! I am very glad to meet you."];
> [secondWindow showWindow:secondWindow];
>
> This code will NOT update NSTextField with text...
>
> secondWindow = [[SecondWindow alloc] init];
> [secondWindow showWindow:secondWindow];
> [secondWindow setStringValueOfMyTextField:@"Hello! I am SecondWindow! I am very glad to meet you.”;
Both of those should work correctly.
—Jens_______________________________________________
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