override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
//after:延时时间
DispatchAfter(after: 1) {
//要延时执行的代码
}
}
/// GCD延时操作
/// - after: 延迟的时间
/// - handler: 事件
public func DispatchAfter(after: Double, handler:@escaping ()->())
{
DispatchQueue.main.asyncAfter(deadline: .now() + after) {
handler()
}
}
swift4-延迟操作
猜你喜欢
转载自blog.csdn.net/weixin_41735943/article/details/84288690
今日推荐
周排行