func delay(delay:Double, closure:()->()) { dispatch_after( dispatch_time( DISPATCH_TIME_NOW, Int64(delay * Double(NSEC_PER_SEC)) ), dispatch_get_main_queue(), closure) } //And now you can talk like this: delay(0.4) { // do stuff }
GCD 延时方法 (Swift)
时间: 2024-10-14 19:00:51