Macos Cocoa中的循环作用
我如何在Cocoa中循环一些动作?例如,我希望文本字段中的随机数每1秒更改一次。您可能希望查看。示例:Macos Cocoa中的循环作用,macos,cocoa,Macos,Cocoa,我如何在Cocoa中循环一些动作?例如,我希望文本字段中的随机数每1秒更改一次。您可能希望查看。示例: -(void)awakeFromNib { [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(changeTextFieldsInt:)
-(void)awakeFromNib {
[NSTimer scheduledTimerWithTimeInterval:1
target:self
selector:@selector(changeTextFieldsInt:)
userInfo:nil
repeats:YES];
}
- (void)changeTextFieldsInt:(NSTimer *)time {
[textField setIntValue:rand()];
}
别忘了IBoutlet文本字段。Xcode只是一个IDE——你的意思是Objective-C/C?