What exactly does the iPhone accelerometer measure?

前端 未结 6 824
星月不相逢
星月不相逢 2021-02-14 04:37

The apple documentation for UIAcceleration class says,

\"When a device is laying still with its back on a horizontal surface, each acceleration event has

6条回答
  •  爱一瞬间的悲伤
    2021-02-14 05:19

    You get a -1 on the Z axis because gravity is acting on the device, applying a constant acceleration of 1G. I assume you want user acceleration, which you can get from the DeviceMotion object using a device motion handler as opposed to an acceleration handler. The userAcceleration property filters out the effects of gravity on the device and only gives you how much the user is accelerating it.

提交回复
热议问题