Delay Actions in Swift

后端 未结 4 584
长情又很酷
长情又很酷 2020-12-24 11:58

I want to make an Activity Indicator start animating and then stop after one second.

So does anyone know how I could do that?

class stuff {
@IBOutlet         


        
4条回答
  •  时光取名叫无心
    2020-12-24 12:41

    With the updated Swift 3 syntax this becomes

    DispatchQueue.main.asyncAfter(deadline: .now() + 4.5) {
        indicator.stopAnimating()
    }
    

提交回复
热议问题