首页 > 代码库 > GCD 延时方法 (Swift)

GCD 延时方法 (Swift)


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}