how to programmatically set outlet to controller
how to programmatically set outlet to controller
- Subject: how to programmatically set outlet to controller
- From: "William Zumwalt" <email@hidden>
- Date: Sat, 30 Jun 2007 01:21:34 -0500
Hi,
At some point in the execution of my app, the user will do an operation
which will programmatically create NSTableHeaderView's (and columns) for my
NSTableView. This subclassed NSTableHeaderView has an outlet in it and I've
instantiated this class in my Nib window and connected it to a controller.
The problem is, when the mouseDown: is executed inside the NSTableHeaderView
subclass, the outlet inside it is null. I believe this is do to the fact
that my subclassed NSTableHeaderView was just created and it's outlet hasn't
been properly connected at the time it was just created. This outlet I have
in my NSTableHeaderView shouldn't be connected because the HeaderView hasn't
been allocated (created) yet. I somehow need to get the instance of a
controller that has already been setup when the program was loaded and set
the outlet for when the header view is created.
This works below, but the problem is that this is a new instance of the
controller and not the instance that is already setup when the program
loaded. I'm just not sure how to grab an existing controller and set an
outlet for the current object at this point.
- (id) init
{
if (self = [super init]) {
if (!networkController) {
networkController = [[NetworkController alloc] init];
}
}
return self;
}
Any help much appreciated.
_______________________________________________
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