我想使用我相信的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/