Find UIControl.Event that produced an action

76 Views Asked by At

In iOS you can assign an action method to several UIControl events, eg.

              ...........   

        self.addTarget(self,
            action: #selector(onTouch(sender:forEvent:)),
            for: .allTouchEvents)

              ...........


   @objc func onTouch(sender: UIControl, forEvent event: UIEvent) {
       // Which UIControl.Event ?
   }

Is it possible in action method to find out, which UIControl.Event triggered the action?

0

There are 0 best solutions below