0

I would like to block interactions with users, with the exception of the double tap for cancel. Is it possible to put isUserInteractionEnabled = false and an exception rule for my double tap lines below ?

override func viewDidLoad() {
    super.viewDidLoad()

    let tapGR = UITapGestureRecognizer(target: self, action: #selector(PostlistViewController.handleTap(_:)))
    tapGR.delegate = self
    tapGR.numberOfTapsRequired = 2
    view.addGestureRecognizer(tapGR)
}

--

extension MainBoardController: UIGestureRecognizerDelegate {
    func handleTap(_ gesture: UITapGestureRecognizer){
        print("doubletapped")
    }
}

Thanks!

Victor
  • 61
  • 1
  • 13
  • Did you run your app and see what happens? – Sweeper Dec 25 '18 at 07:50
  • If you're setting `numberOfTapsRequired` to 2 I believe that should be already enough to apply the 2 tap constraint. Remember to set `isUserInteractionEnabled = true` to make the gesture recognizer work. – Cesare Dec 25 '18 at 09:39
  • The fact is that I launch a firebase upload of a file. I use a spinner to indicate the progress of the upload and I disable the userinteraction but I just want the double tap to work, to cancel the uploading of the file. – Victor Dec 25 '18 at 09:51

0 Answers0