Swift dispatch_after替代ios performSelector

来源:互联网 发布:手机怎么链接电脑网络 编辑:程序博客网 时间:2024/06/05 05:12
func delayPerform(intervals: Double!,action:() -> Void) -> Void{
    let delayIntervals = Double(NSEC_PER_SEC) * intervals
    let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delayIntervals))
    dispatch_after(time, dispatch_get_main_queue(), action)
}
0 0
原创粉丝点击