禁用90秒按钮时$ P $的迅捷pssed [英] Disable a Button for 90 sec when pressed in swift
本文介绍了禁用90秒按钮时$ P $的迅捷pssed的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有按钮显示一个模式的看法,但我想,如果用户点击他不会能够再次使用它为90秒。我怎样才能做到这一点?
I have button that show up a modal view but i want that if the user click it he wont be able to use it again for 90 seconds. how can i do this?
推荐答案
在按钮的IBAction为禁用按钮,设置这样的计时器:
In the IBAction of the button disable the button and set a timer like this:
self.button.enabled = false
NSTimer.scheduledTimerWithTimeInterval(90, target: self, selector: "enableButton", userInfo: nil, repeats: false)
和创建称为FUNC当定时器计数结束:
And create the func called when the timer ends counting:
func enableButton() {
self.button.enabled = true
}
这篇关于禁用90秒按钮时$ P $的迅捷pssed的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文