Re: NSTableView questions
Re: NSTableView questions
- Subject: Re: NSTableView questions
- From: Chris Williams <email@hidden>
- Date: Sat, 06 Oct 2007 10:11:51 -0700
- Thread-topic: NSTableView questions
Excuse me, in the interest of brevity I trimmed.
In the class definition:
(IBOutlet) NSTableView *theTable;
And connect in IB
In various implementation module(s):
extern NSTableView *mainTable;
In the main implementation:
- (void)awakeFromNib {
mainTable = theTable;
}
As to the religious debate over externs... I'll leave that to zealots. If
you have two classes with no connection other than the fact that they reside
in the same NIB, externs like this are an easy way (but admittedly not the
only way) to connect them.
From: Uli Kusterer <email@hidden>
Subject: Re: NSTableView questions
Are you sure this will compile? I never heard about being able to
use "extern" with an outlet, and the brackets shouldn't work either.
IBOutlet is only a marker that you put next to *instance* variables
of objects (i.e. instances), so that when you drag the header onto
one of Interface Builder's NIB windows to have it parsed, it'll know
that this instance variable is supposed to be an outlet and that you
want to be able to hook up another object in the NIB to it.
So yes, IBOutlet is what Hrishikesh will want to use here. But
extern and regular variables don't enter the picture here. ALso, an
extern isn't really a good design anyway. Use an accessor method on
the object here.
_______________________________________________
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