iOS - 如何判断设备是否被提升/丢弃(CoreMotion) [英] iOS - How to tell if device is raised/dropped (CoreMotion)

查看:183
本文介绍了iOS - 如何判断设备是否被提升/丢弃(CoreMotion)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用CoreMotion告诉iOS设备是否已升级? (例如,在单个抖动中有一个)。位移不重要(在这种情况下,它将小于50厘米)

How can I tell, using CoreMotion, if the iOS device is raised or dropped? (for example, there is one of each in a single "shake"). The displacement does not matter (in this case it would be less than 50 centimeters)

这将在所有设备上工作吗? (原因可能不是硬件)

And would this work on all devices? (reasons it wouldn't work may be due to hardware)

感谢您的帮助!

推荐答案

此问题已弹出

长篇小说,您需要 userAcceleration 。检查其在x,y和z方向上的分量。如果z分量很重要,x和y不是,那么你的手机是垂直加速度(被提升/放弃)。

Long story short, you need the userAcceleration. Check for its component in the x, y and z directions. If the z component is significant and the x and y are not then your phone is accelerationg vertically (being raised / dropped).

如果你想检测震动,用户加速度的突然变化。您可能需要使用高通滤波器

If you want to detect shakes then look for the sudden changes in the user acceleration. You might want to use a high-pass filter for that.

这篇关于iOS - 如何判断设备是否被提升/丢弃(CoreMotion)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆