我正在尝试确定 PDFView 上的触摸位置。我已将我的 pdf 视图设置为与用户交互,如下所示:
pdfView?.isUserInteractionEnabled = true
然后我使用以下函数来检测触摸:
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
if let touch = touches.first {
let position = touch.location(in: pdfView)
print(position)
}
}
touchesBegan 代码永远不会被触发。