iPhone通过手指运动识别不同的形状

发布于 2024-12-25 09:46:47 字数 102 浏览 0 评论 0原文

我正在为 iPhone 开发一个应用程序,我想当我的手指在 iPhone 表面移动时检测不同的形状。任何人都可以帮助我,如何通过 iPhone sdk 中的手指运动或手势检测不同的几何形状。

I'm developing an application for iPhone, and I want to detect different shapes as my fingers move on iPhone surface. Can anybody help me, how can I detect the different geometric shapes via finger movement or gesture in iPhone sdk.

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

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

发布评论

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

评论(3

↘人皮目录ツ 2025-01-01 09:46:47

你可以做到,但这不是一件容易的事。 iPhone SDK 提供了 UIGestureRecognizer 类,您可以创建一个 UIGestureRecognizer 的子类来识别独特的手势或字符(在您的情况下)。

但还有另一种方法。 Brit Gardner 在他的博客。这种方法的基础是基于 JavaScript 的 N 美元识别器。这个人做得很好,现在您可以使用 MultirinkleGestureRecognizer-iOS 库来检测符号和形状。当然,这个库并不完美,它使用特定的方式(如 JSON)来识别触摸,但总比没有好。

谢谢,希望这对某人有帮助。

You can do it, but it's not an easy task. iPhone SDK provides UIGestureRecognizer class, you may create a subclass that UIGestureRecognizer that recognizes a distinctive gesture or character (in your case).

But there is also another approaches. One of them described by Brit Gardner in his blog. Underlying this approach is the N-Dollar Recognizer based on JavaScript. This guy had done a nice job and now you can use MultistrokeGestureRecognizer-iOS library for detecting symbols and shapes. Of course, this library is not perfect and it use specific way (like JSON) to recognize touches, but it's better than nothing.

Thanks, hope this help someone.

这样的小城市 2025-01-01 09:46:47

iOS SDK 文档中内置了一个示例自定义 UIGestureRecognizer,其中 在这里识别复选标记手势,特别是在标题为“创建自定义手势”的部分中识别器”(无法找到直接链接该部分的简单方法)。使用它作为模板,您应该能够编写自定义手势识别器来正确识别您的手势。

您必须自己提供的部分是代码,它为您的设备定义了使您感兴趣的特定形状到底意味着什么。

顺便说一句,我也在编写自己的自定义 UIGestureRecognizer 作为识别连续手势的示例,而不是复选标记的离散手势识别,因为我之前很欣赏这样的示例。

它可以在 Github 上找到。

There is a sample custom UIGestureRecognizer built inside the iOS SDK documentation which recognizes a checkmark gesture here, specifically in the section entitled "Creating Custom Gesture Recognizers" (couldn't find an easy way to directly link the section). Using this as a template, you should be able write a custom gesture recognizer to correctly recognize your gesture.

The part you will have to provide yourself is the code which defines for your device what exactly it means to make your particular shape of interest.

Incidentally, I'm also in the process of writing my own custom UIGestureRecognizer as an example of recognizing a continuous gesture as opposed to the checkmark's discrete gesture recognition as I would have appreciated an example of this previously.

It is available on Github.

十二 2025-01-01 09:46:47

早在 2009 年,Daniele Margutti 创建了 MCGestureRecognizer 项目,该项目也基于 http://depts.washington.edu/aimgroup /proj/dollar/

如果你能找到这个,它会给你一个很大的提示,但可能需要更新到 ios5。它曾经可以在 http://www.malcom-mac.com 上找到,但该网站似乎是向下。

Back in 2009 Daniele Margutti created MCGestureRecognizer project also based upon http://depts.washington.edu/aimgroup/proj/dollar/

If you can find this it will give you a big heads up but will likely need updating to ios5. It used to be available at http://www.malcom-mac.com but that site seems to be down.

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