views:

76

answers:

3

How do I call setStatus from within awakeFromNib?

-(void)awakeFromNib {
    setStatus; // how?
}

/* Function for setting window status */
- (void)setStatus {
    [statusField setStringValue:@"Idle"];
}
+9  A: 

In Objective-C, you use self to refer to the current object:

[self setStatus];
KennyTM
+2  A: 

Maybe you might want to revise that method to be this:

- ( void ) setStatus: ( NSString *) status {

    [ statusField setStringValue: status ];

}

You can then call it like this:

[ self setStatus: @"Idle" ];
Jacob Relkin
A: 

Thanks..

And if I want to have variables in my string?

F.ex:

[self setStatus:@"Analysing %@", sourceFile];
s0mmer
`[self setStatus: [NSString stringWithFormat: @"Analysing %@", sourceFile]];`
JeremyP