How can I delay a method call for 1 second?

前端 未结 11 1392
别跟我提以往
别跟我提以往 2020-11-30 18:19

Is there an easy way delay a method call for 1 second?

I have a UIImageView that reacts on a touch event. When the touch is detected, some animations ha

11条回答
  •  心在旅途
    2020-11-30 18:48

    There is a Swift 3 solution from the checked solution :

    self.perform(#selector(self.targetMethod), with: self, afterDelay: 1.0)
    

    And there is the method

    @objc fileprivate func targetMethod(){
    
    }
    

提交回复
热议问题