I have the following code:
@interface AXWindowController : NSWindowController {
IBOutlet NSTextField *text;
IBOutlet NSTextField *otherText;
}
- (void) setText: (NSString *)input;
- (void) setOtherText;
@end
@implementation AXWindowController
- (void) setText: (NSString *)input
{
[text setStringValue:input];
}
- (void) setOtherText
{
[otherText setStringValue:@"nag"];
}
@end
And when I run:
1. [controller showWindow:nil];
2. [controller setText:@"lol"];
3. [controller setOtherText];
Line 3 executes correctly, but line 2 does nothing. In fact, when I look at text and otherText in gdb while executing lines 2 and 3, I get the following results:
(gdb) p text
$1 = (NSTextField *) 0x0
(gdb) p otherText
$2 = (NSTextField *) 0x1385d1e0
What is happening? I can't pass in the input variable to a set function for an NSTextField? Why is my NSTextField becoming null when I change the parameters of the set function?