gpt4 book ai didi

ios - 快速点击手势识别器未触发

转载 作者:行者123 更新时间:2023-11-30 12:42:14 27 4
gpt4 key购买 nike

每当我点击 UIPickerView 中的某个项目时,我想触发点击手势。

我正在使用以下长按手势代码,效果很好。但是,如果我切换到 UITapGestureRecognizer,则不会触发任何内容。

@IBOutlet weak var showClaims: UIPickerView!

override func viewDidLoad() {
super.viewDidLoad()
showClaims.isUserInteractionEnabled = true
let tapped = UITapGestureRecognizer(target: self, action: #selector(ClaimVC.SelectClaimInfo))

showClaims.addGestureRecognizer(tapped)
}

func SelectClaimInfo() {
GetClaimInfo()
}

最佳答案

对于那些在完成所有操作之前点击手势不起作用的人:

let tap = UITapGestureRecognizer(target: self, action:#selector(self.handleTap(_:)))
myView.addGestureRecognizer(tap)

尝试符合UIGestureRecognizerDelegate然后mKE tap.delegate = self 并且您必须实现此 UIGestureRecognizerDelegate 方法制作

func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
return true
}

关于ios - 快速点击手势识别器未触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42093693/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com