【发布时间】:2016-06-23 06:32:11
【问题描述】:
我想使用适用于 iOS 7 的 coreMotion 框架检测设备抖动。谁能帮我解决这个问题?
我在 viewDidAppear 中编写了下面描述的代码
CMMotionManager *motionManager = [[CMMotionManager alloc] init];
motionManager.deviceMotionUpdateInterval = 1.0/60.0;
__block double myAcceleration;
[motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue]
withHandler:^(CMDeviceMotion *motion, NSError *error)
{
myAcceleration = motion.userAcceleration.y;
CATransform3D transform;
transform = CATransform3DMakeRotation(
motion.attitude.pitch, 1, 0, 0);
transform = CATransform3DRotate(transform,
motion.attitude.roll, 0, 1, 0);
transform = CATransform3DRotate(transform,
motion.attitude.yaw, 0, 0, 1);
}
];
但未检测到抖动。
【问题讨论】:
-
嘿,如果有人知道在 ios 7 及更高版本中使用 core motion 进行摇动,请分享您的答案
标签: ios7 gesture core-motion