开发者

delegate method for CMMotionManager

开发者 https://www.devze.com 2023-03-23 07:20 出处:网络
I just want to know that when we call the method of startGyroUpdates with CMMotionManager and fix some updateInterval say to 1.0/60.0 , then开发者_JAVA百科 is there any delegate method that we have to

I just want to know that when we call the method of startGyroUpdates with CMMotionManager and fix some updateInterval say to 1.0/60.0 , then开发者_JAVA百科 is there any delegate method that we have to implement where we can get the gyro updates. If not then where/how we can get the gyro-updates.

Also if there is some useful code snippet to find out device change in position i-e if the device is moved up or down from some reference point.


Documentation says:

startGyroUpdates Starts gyroscope updates without a handler.

- (void)startGyroUpdates

Discussion You can get the latest gyroscope data through the gyroData property. You must call stopGyroUpdates when you no longer want your application to process gyroscope updates.

Availability Available in iOS 4.0 and later. See Also

– startGyroUpdatesToQueue:withHandler:

Declared In CMMotionManager.h


Adding to xs2bush's correct answer: See the documentation links in Simple iPhone motion detect for more information.

Regarding the second point moved from some reference point, definitely not. At the moment there is no way at all to determine displacement with an acceptable precision. There are several questions and discussions about this like Getting displacement from accelerometer data with Core Motion or Measuring time the vehicle takes to accelerate in iPhone (I don't believe the 3% ;-)

0

精彩评论

暂无评论...
验证码 换一张
取 消