禁用和延迟 IBAction 按钮
我有一个 IBAction 按钮,我想在 30 秒延迟后启用它。该按钮将出现在视图中,但禁用 30 秒。
有谁知道我将如何去做这件事?
这就是我所拥有的 - 一个播放一些音频的简单 IBAction:
-(IBAction) playSound:(id)sender {
[theAudio play];
}
I have an IBAction button that I would like to enable after a 30 second delay. the button would be in the view but disabled for 30 secs.
Does anyone know how I would go about doing this?
Here's what I have - a simple IBAction that plays some audio:
-(IBAction) playSound:(id)sender {
[theAudio play];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用这个:
假设您想在按下按钮时禁用该按钮。
You can use this:
Assuming that you want to disable the button when it gets pressed.
在 viewDidLoad 或您想要的其他合适的方法中:
然后,
注意:我还没有编译代码,只是编写了。可能有错别字。
In viewDidLoad or other suitable method that you want:
Then,
NOTE : I have not compiled the code, just wrote. There might be typo.