开发者

How to call method inside class

How do I call setStatus from within awakeFromNib?

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

/* Function for setting wind开发者_运维知识库ow status */
- (void)setStatus {
    [statusField setStringValue:@"Idle"];
}


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

[self setStatus];


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" ];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜