> Well, you've switched from talking about a window controller to a view 
> controller for some reason.  

Sorry, was a typo I meant LTWWindowController, I’m so used to typing 
ViewController that I guess my fingering did the thinking in this case!

Fixed the warnings too, thanks again for your help everyone.

Dave


> On 16 Feb 2015, at 19:28, Ken Thomases <k...@codeweavers.com> wrote:
> 
> On Feb 16, 2015, at 11:55 AM, Dave <d...@looktowindward.com> wrote:
> 
>>> You never want a NIB for the window controller that's separate from the NIB 
>>> containing the window.  You want a single NIB for the window which the 
>>> window controller will load and be the owner of.  The NIB will *not* 
>>> "contain" the window controller.  The File's Owner placeholder in the NIB 
>>> represents the window controller, but the window controller will be created 
>>> before the NIB is loaded and will, in fact, be the thing which loads the 
>>> NIB.
>> 
>> This is what I don’t get! If I have:
>> 
>> LTWViewController.h and LTWViewController.m, and LTWWindow.xib, then set the 
>> file owner in the NIB to “LTWViewController”, how do I then wire up outlets, 
>> bindings and actions so that I get properties set in LTWViewController?
> 
> Well, you've switched from talking about a window controller to a view 
> controller for some reason.  That aside, when you set the class of File's 
> Owner that lets IB know what outlets and action methods the File's Owner 
> supports.  So, if you have set the class of File's Owner to LTWViewController 
> (to follow your example), then the File's Owner placeholder now has whatever 
> outlets you have defined on the LTWViewController class.  You connect the 
> outlets from the File's Owner placeholder to whatever object they are 
> supposed to reference.
> 
> When a window controller loads a NIB, it typically provides itself as the 
> owner of the NIB.  That means that the NIB loading machinery will use that 
> window controller as the real object that the File's Owner placeholder was 
> holding the place for.  So, any outlet connections established in the NIB 
> from the File's Owner placeholder will actually set the properties of the 
> window controller (assuming they exist).  Any controls whose actions were 
> connected to the File's Owner placeholder as the target will actually have 
> their target set to the window controller.  Etc.
> 
> Likewise for a view controller, but the NIB should only contain a view in 
> that case, not a window.
> 
> 
>> I can see I could do it if I had LTWViewController.xib that included an 
>> NSWindow?
> 
> Huh?  Why does the name of the NIB file make a difference?
> 
> 
>> Thanks a lot.
> 
> You're welcome.
> 
> Regards,
> Ken
> 


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to