ios - 使用核心 Action 确定iOS学位程度的读数

标签 ios core-motion

我想使用我相信的Core Motion计算液位读数,如此处显示的本机iOS应用程序中所示:http://www.slate.com/blogs/future_tense/2013/09/21/ios7_tips_compass_app_secretly_has_a_level_and_it_s_addictive.html

我该如何实现?

最佳答案

我发现您可以从deviceMotion.gravity实例的CMMotionManager获取角度。

self.motionManager = [[CMMotionManager alloc] init];
[self.motionManager startDeviceMotionUpdates];

CMDeviceMotion *deviceMotion = self.motionManager.deviceMotion;
const CGFloat currentXDegrees = radiansToDegrees(deviceMotion.attitude.roll);
const CGFloat currentYDegrees = radiansToDegrees(deviceMotion.attitude.pitch);

关于ios - 使用核心 Action 确定iOS学位程度的读数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39521091/

相关文章:

ios - 如何在Bootstrap中设置iOS状态栏背景颜色?

ios - 有没有办法仍然使用 Xcode 4 调试 iPhone 5s

ios - Unity和iPhone XR的大片错误(特别是)

iOS 12.2 : CMMotionManager is blocking the main thread

swift - 核心运动计步器保存到 Firebase

ios - 在 iOS 中创建具有不同可触摸区域的圆圈

ios - 多个 Pin 注解

ios - 无法从 NSMutableArray 中正确检索对象

iphone - 简单的 iPhone 运动检测

iphone - 核心运动陀螺仪360度值