Delete that init method. Xcode has a standard template and doesn't change it 
when you tick the "make a xib file" checkbox. Replace it with

- (id)init
{
   return [self initWithWindowNibName:@"myGeneratedNibFileName"];
}


There are plenty of sample apps you can download from Apple that use windows in 
separate nibs; if you search for initwithwindownibname you'll find several of 
them. Cocoa isn't that easy to just start from scratch with (which is one of 
the reasons for Swift); I rarely start with the "new application" template, I 
find some useful sample and start modifying it.

----- Original Message -----
From: "William Squires" <[email protected]>
To: "Cocoa Developers" <[email protected]>
Sent: Saturday, June 7, 2014 12:24:02 PM
Subject: Another dumb question about NSWindowController(s)

  Okay, if I create a new NSWindowController subclass (and tell Xcode to 
generate the .xib as well), it gives me simple (too simple, I think) template 
code, whose init... method takes an NSWindow reference. Where does this come 
from (the reference)?

• Is the code instantiating the custom NSWindowController subclass supposed to 
allocate the NSWindow reference, and - if so - how? I thought the controller 
was supposed to mediate interactions between the UI and any models or other 
controllers, according to MVC; other code shouldn't have to worry about how or 
where the window comes from.
• Or is this one of those "magical" things that's automatically hooked up when 
the .xib gets unarchived? If so, how, since I would think the controller would 
have to load the .xib first, and the template code simply contains no reference 
to loading (any) xib!

  Unfortunately, all my "program in MacOS X...." books are really out-of-date; 
what with all the publishers focusing on either Android or iOS these days... :( 
(a look about in Barnes & Noble the other day revealed NO books on OS X 
programming.)
  Could someone on this list please help me understand how a window, and its 
controller, are supposed to be loaded/instantiated/unarchived (that's not in 
the MainMenu.xib, but in a separate set of files (the header, implementation, 
and xib, all related by the class name)?

P.S. This is with Xcode 5.1.1 on MacOS X 10.8, compiling for MacOS X 64 bit, 
10.7 SDK.


_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://urldefense.proofpoint.com/v1/url?u=https://lists.apple.com/mailman/options/cocoa-dev/lrucker%2540vmware.com&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=yJFJhaNnTZDfFSSz1U9TSNMmxGyib3KjZGuKfIhHLxA%3D%0A&m=k%2FakAPc5IK5NJVzqMjwtzYLBhNM5wfOiBUVCrkBCutQ%3D%0A&s=d7a6014cb6ae915342e5d83321d12827ea04320235ea1d8629562b8b19c10996

This email sent to [email protected]

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to