Re: connections and the nib lifecycle
Re: connections and the nib lifecycle
- Subject: Re: connections and the nib lifecycle
- From: Chris Hanson <email@hidden>
- Date: Wed, 21 May 2008 20:15:07 -0700
On May 21, 2008, at 9:05 AM, Torsten Curdt wrote:
I have a class that extends NSWindowController.
- (void) test:(NSString*)string
{
[textField setStringValue:string];
NSLog(@"textField=%@", textField);
int ret = [NSApp runModalForWindow:[self window]];
NSLog(@"textField=%@", textField);
Looking into the test method. Why on earth is the textField nil
first and only after the runModalForWindow holds the proper
reference??
I've already gotten the awakeFromNib and even the windowDidLoad
message!
You should not have received either -awakeFromNib or -windowDidLoad
for the particular window controller that is running your window.
When you invoke -[NSWindowController window], *that* is when the nib
is loaded.
I suspect you have not one but two instances of your
NSWindowController subclass. You have MyWindowController specified as
the File's Owner of your window's nib file, and I bet you *also* have
a separate instance of MyWindowController as an object in the nib file
(or in another nib file).
You can determine this by modifying your NSLog statements like this:
NSLog(@"%@.textField = %@", self, textField);
That will log the description of the object itself, not just the value
you care about. I suspect that you will see two different window
controllers being created.
-- 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