使用NSTimer创建一个整洁的延迟功能 - 斯威夫特
问题描述:
我想创建一个简单而整洁的函数,它使用NSTimer为括号中的内容添加延迟。对于例如使用NSTimer创建一个整洁的延迟功能 - 斯威夫特
func Adddelay(delay:Double, closure:()->()) {
//Code in here using NSTimer that will add a delay for as long as stated in delay (the number passed in)
}
从此,我试图旨在通过打算使用它:
delay(1){
//Code in here that will execute after a delay of one second
}
功能需要使用的NSTimer什么我使用它作为一个整体。
任何帮助将不胜感激。
有什么错http://*.com/a/29338910/1187415? – 2015-04-01 05:05:56
它确实工作正常,但我了解NSTimer并知道如何将它用于我需要的功能,我只需要帮助将它变成简单功能以便于使用。 – JohnnyCash 2015-04-01 05:57:46