首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NSCombobox,NSTimer

NSCombobox,NSTimer
EN

Stack Overflow用户
提问于 2011-09-21 05:31:56
回答 1查看 84关注 0票数 0

我有计时器的代码,时间间隔为5秒。有没有一种简单的方法可以用NSCombobox或类似的东西来控制时间间隔?假设:我想在组合框中选择1到5秒的计时器间隔。

代码语言:javascript
复制
[NSTimer scheduledTimerWithTimeInterval:5.0
                                 target:self
                               selector:@selector(updateTextFieldWithRandomNumber)
                               userInfo:nil
                                repeats:YES];
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-09-21 05:44:41

您可以从任何NSControl子类获取doubleValue

代码语言:javascript
复制
[NSTimer scheduledTimerWithTimeInterval:[myComboBox doubleValue]
                                 target:self
                               selector:@selector(updateTextFieldWithRandomNumber)
                               userInfo:nil
                                repeats:YES];
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7492048

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档