找出 iPhone 中的碰撞力

发布于 2024-08-04 03:26:31 字数 582 浏览 4 评论 0 原文

我必须开发一个应用程序。我必须在自行车上安装一个像车速表这样的指示器。

iPhone 被放在汽车的角落里。

iPhone 被放置在车内,无法掉落到任何地方,甚至无法移动。 (车内有一个专门放置iPhone的地方)。

现在,汽车的发展进展顺利。

指示器指示零——这是顺利的方式。

假设汽车经过一个颠簸处。

iPhone 应该跟踪这些移动。如果凹凸很大:

  • iPhone 应显示 - 巨大凹凸 - 最大指示器

如果凹凸较低:

  • iPhone 应显示 - 正常凹凸 - 指示器中间

其他:

  • iPhone 应显示 - 平滑道路 - 零指示器

我知道如何添加抖动处理程序,如给定的在以下链接中: iPhone 中的加速计范围

但是这里 iPhone 不会摇晃吗?它是在固定的地方。

解决方案应该是什么?

I have to develop an application. I have to put an indicator like speedometer in the bike.

iPhone is put in the corner of a Car.

The iPhone is in a placed in a car, from where it can't be dropped anywhere and can't be moved even. ( There is a special place in car where user place iPhone ).

Now, Car is going on a smooth way.

Indicator indicates zero - that is smooth way.

Suppose, a bump is passed by the car.

These movement should be tracked by iPhone. If bump is huge:

  • iPhone should display - huge bump - maximum indicator

If bump is low:

  • iPhone should display - normal bump - middle at indicator

else:

  • iPhone should display - smooth road - zero indicator

I know how to add shake handler, as given in following link:
accelerometer range in iPhone

But here iPhone is not going to be shake? It is in fixed place.

What should be the solution?

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

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

发布评论

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

评论(2

夜未央樱花落 2024-08-11 03:26:31

You'll need to use the UIAccelerometer, UIAccelerometerDelegate, and UIAcceleration classes. Here is some Sample Code.

北方。的韩爷 2024-08-11 03:26:31

iPhone 会晃动 - 它连接到汽车上,汽车也会晃动。您应该能够使用与用手摇动相同的代码。

The iPhone will be shaking - it's attached to the car, and the car will be shaking. You should be able to use the same code as you would if you were shaking it with your hand.

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