0

我想阻止与用户的交互,但双击取消除外。是否可以在下面为我的双击线添加isUserInteractionEnabled = false 和例外规则?

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")
    }
}

谢谢!

4

0 回答 0