gpt4 book ai didi

ios - 在点处从 PDFAnnotation 中查找注释

转载 作者:行者123 更新时间:2023-11-28 11:29:50 24 4
gpt4 key购买 nike

我在 View 中添加了一些注释。我现在要做的是从我的触摸位置找到这些带有 CGPoint 的注释。这是我到目前为止得到的:

func annotationWithHitTest(at: CGPoint) -> PDFAnnotation? {
for annotation in annotations {
return annotation
}
return nil
}

所以在我所有注释的循环中,我试图找到最接近我的 CGPoint 的那个。我将如何做到这一点?

更新

我能够获得注释的 CGPoint,但它通常与我的触摸位置的 CGPoint 不匹配,所以我能得到它以便找到壁橱元素吗?

func annotationWithHitTest(at: CGPoint) -> PDFAnnotation? {
for annotation in annotations {

print("Touch")

print(at)

print("Annotation")

print(annotation.bounds.origin)

return annotation
}
return nil
}

最佳答案

-- 已更新 -- 意识到这是针对 PDFAnnotation,而不是 UIView。

您可以找到使用 PDFAnnotation API 选择的点..

https://developer.apple.com/documentation/pdfkit/pdfpage/1504793-annotation

关于ios - 在点处从 PDFAnnotation 中查找注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57171116/

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