I am trying to dissect "Sketch-112" and in the process wrote something small which is not working quite the way I wish.
SetUP.
AppController with 1 IBOutlet, (An NSTextField) which is instantiated in the nib. I just left the word "label" intact on the NSTextField.
In the init method of AppController this:
and the relevant setter this:
Now the output is this:
So, the problem seems to be that the word "Label" is added after the setter is called. Could anyone possibly explain the issue and how to get around this?
Thanks ...in advance...as usual.
SetUP.
AppController with 1 IBOutlet, (An NSTextField) which is instantiated in the nib. I just left the word "label" intact on the NSTextField.
In the init method of AppController this:
Code:
NSColor * g = [ NSColor greenColor];
NSString *s = @"Hello World";
NSTextField *f = [[NSTextField alloc]init];
[f setBackgroundColor:g];
[f setStringValue:s];
NSLog(@"The value of TextField \"f\" is: %@",[f stringValue]);
[self setTextField: f];
and the relevant setter this:
Code:
- (void) setTextField: (NSTextField*) t
{
if ( _textField == t)
return;
[_textField release];
[t retain];
_textField = t;
NSLog(@"The value of TextField \"_textField\" is: %@",[_textField stringValue]);
}
Now the output is this:
The value of TextField "f" is: Hello World
The value of TextField "_textField" is: Hello World
The value of TextField "_textField" is: Label
So, the problem seems to be that the word "Label" is added after the setter is called. Could anyone possibly explain the issue and how to get around this?
Thanks ...in advance...as usual.