我有计时器的代码,时间间隔为5秒。有没有一种简单的方法可以用NSCombobox或类似的东西来控制时间间隔?假设:我想在组合框中选择1到5秒的计时器间隔。
[NSTimer scheduledTimerWithTimeInterval:5.0
target:self
selector:@selector(updateTextFieldWithRandomNumber)
userInfo:nil
repeats:YES];发布于 2011-09-21 05:44:41
您可以从任何NSControl子类获取doubleValue:
[NSTimer scheduledTimerWithTimeInterval:[myComboBox doubleValue]
target:self
selector:@selector(updateTextFieldWithRandomNumber)
userInfo:nil
repeats:YES];https://stackoverflow.com/questions/7492048
复制相似问题