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 09:17:25 -0700
On Jul 7, 2011, at 5:03 AM, Kevin Muldoon wrote:
> So, I'm not entirely certain Wim. I kinda feel I'm caught between the xCode
> 3 way of doing things and xCode 4 (and all the variants in between).
I don’t see a difference. Xcode is just a tool; it doesn’t dictate the ways you develop code. If anything, it’s the releases of the OS that introduce and deprecate ways of doing things.
And both NSWindowController and manual nib loading have been around forever.
> 1) So, how exactly is SecondWindow.m going to know about and act upon a NSButton or NSTextField within in the SecondWindow.xib?
The usual way: You declare the button as an IBOutlet in SecondWindow’s instance variable declarations, and wire it up to the actual control in IB.
> 2) Shouldn't [secondWindow close] be working just as [secondWindow window] is working?
Actually calling -window isn’t the right way to show the window. All it does is cause the window to be loaded; this may or may not cause the window to be visible depending on how you set the ‘visible at launch time’ flag on the window in IB. Usually you want this flag to be false so that NSWindowController can customize the window bounds (tiling or restoring) before it’s displayed. If you want to show the window, call -showWindow:.
> For some reason, [secondWindow close] isn't working at all. At least the documentation says this is how it's done.
Hm. My first guess is that you didn’t wire up the window to the NSWindowController’s inherited ‘window’ outlet. Lots of things won’t work unless you do this. (You also have to wire up the window’s delegate to the controller.)
—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