开发者

How to call method inside class

开发者 https://www.devze.com 2022-12-29 04:12 出处:网络
How do I call setStatus from within awakeFromNib? -(void)awakeFromNib { setStatus; // how? } /* Function for setting wind开发者_运维知识库ow status */

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

精彩评论

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

关注公众号