Re: Is it possible to pass an object to a NIB
Re: Is it possible to pass an object to a NIB
- Subject: Re: Is it possible to pass an object to a NIB
- From: Chris Hanson <email@hidden>
- Date: Fri, 04 Dec 2009 20:28:31 -0800
On Dec 4, 2009, at 7:47 PM, DeNigris Sean wrote:
> I'm writing a RubyCocoa app, but my question is on the Cocoa API...
>
> I'm trying to unit test a view class. As it is very thin (just delegates all work to the controller), all I want to check is that my connections (e.g. outlets and actions) are hooked up correctly.
>
> I've been trying to:
> 1. Create an instance of my class
> 2. use NSBundle::loadNibFile: externalNameTable: withZone: to load the nib
> 3. check the connections
Really, the external name table is for referring to objects in nibs, rather than pushing objects into nibs.
Furthermore, from your further description it sounds like what you’re referring to as a “view” is actually a subclass of NSWindowController; it knows how to load a nib file already, so you should just leverage that rather than try to do it all yourself by hand.
All you should need to do is instantiate your window controller, invoke its -window method to force it to load its associated nib file, and then check that its outlets are wired up as you expect.
— Chris
_______________________________________________
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