我已使用此代码获取 G-Force 值。但问题是当我把我的 iPhone 放在桌子上时,它仍然显示 0.99 值。谁能告诉我原因?代码是
sx = acceleration.x * kFilteringFactor + sx * (1.0 - kFilteringFactor);
sy = acceleration.y * kFilteringFactor + sy * (1.0 - kFilteringFactor);
sz = acceleration.z * kFilteringFactor + sz * (1.0 - kFilteringFactor);
float aValue = sqrt(sx*sx+sy*sy+sz*sz);
[gLabel setText:[NSString stringWithFormat:@"%.2f",aValue]];