如何向函数添加计时器 - IOS Swift
How to add a timer to a function - IOS Swift
假设我有一个功能,任何功能,我只想 运行 三秒钟,然后再也不会 运行。我该怎么做?我会使用 NSTimer 吗?感谢您的帮助。
给你,
NSTimer.scheduledTimerWithTimeInterval(3, target: self, selector: Selector("updateProgress:"), userInfo: nil, repeats: false)
func updateProgress(timer: NSTimer){
}
假设我有一个功能,任何功能,我只想 运行 三秒钟,然后再也不会 运行。我该怎么做?我会使用 NSTimer 吗?感谢您的帮助。
给你,
NSTimer.scheduledTimerWithTimeInterval(3, target: self, selector: Selector("updateProgress:"), userInfo: nil, repeats: false)
func updateProgress(timer: NSTimer){
}