Re: Getting a NSView pointer from a nib
Re: Getting a NSView pointer from a nib
- Subject: Re: Getting a NSView pointer from a nib
- From: Warner Onstine <email@hidden>
- Date: Fri, 28 Apr 2006 07:02:13 -0700
Forgot to send this to the whole list.
You can do this through your controller. Here's one of the things I
got from Hillegass (Cocoa Programming for Mac OS X):
In your controller header:
@interface MyController : NSWindowController
{
IBOutlet NSTableView * tableView;
}
Then create an instance of your controller in IB. Once this instance
is created you bring up the inspector through Command+Shift+I and
choose connections. To create a connection from your view variable
and the actual view Ctrl+Drag from the Controller to the NSView you
want to connect to and then select the view variable you created
above and click Connect in the Connections list.
I think that's it, but I may have missed something.
If you haven't picked up either/both Cocoa Programming for Mac OS X
or Learning Cocoa by James Duncan Davidson I highly recommend both of
them.
-warner
On Apr 28, 2006, at 6:27 AM, Milen Dzhumerov wrote:
Hi all,
I was wondering today if is possible to retrieve a NSView* from a
nib. For example I have a nib which just contains a custom view on
which several controls are laid out. What I want to do is get a
pointer to that view (instantiate the nib first) and make it the
content view of another window (eg. the custom view could contain
preferences controls for a preferences window). I'm also wondering
how am I going to connect the separate nib with the rest of the
application... I suppose I have to do everything programmatically.
Thanks for your help.
PS. I should note that I'm not quite familiar with the whole Nib
concept so I'm trying to apply techniques from other programming
environments (I'm basically thinking of Nib files as files
describing interface elements which I can instantiate later
programmatically somewhere in the application a la Glade from the
GTK+ environment). I'm getting a few books on Cocoa next week so I
won't bother the list anymore with my lame (and probably off-topic)
question.
Kind regards,
Milen Dzhumerov
Web: http://1nsp1r3d.co.uk/
Email: email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40warneronstine.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden