追踪 CGPath/UIBezierpath

发布于 2025-01-03 06:25:56 字数 125 浏览 6 评论 0原文

我希望用户能够用手指追踪预定义的 CGPath/UIBezierpath,并在超出线条时收到警告(假设线条粗细为 30px,以使其更容易)。

基于触摸事件方法返回的事件量根据手指的移动而变化的知识,我将如何执行此类检查?

I would like the user to be able to trace a predefined CGPath/UIBezierpath with their finger and get a warning if they go outside of the lines (say the line thickness is e.g. 30px to make it easier).

How would I perform such a check based on the knowledge that the amount of events returned by the touch event methods vary depending on the finger's movement?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧竹 2025-01-10 06:25:56

使用 CGPathCreateCopyByStrokingPath 创建轮廓描边路径的路径。然后使用 CGPathContainsPoint 来测试触摸点是否在该轮廓内。

Use CGPathCreateCopyByStrokingPath to create a path that outlines the stroked path. Then use CGPathContainsPoint to test whether the touched point is inside that outline.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文