iOS Gyroscope API

前端 未结 2 1953
难免孤独
难免孤独 2020-12-30 06:42

I am learning to write an app using the gyroscope sensor in iOS. Are there classes for dealing with the gyroscope similar to UIAcceleration/UIAccelerometer/UIAccelerometerDe

2条回答
  •  北海茫月
    2020-12-30 07:30

    For gyroscope data, you'll need to use CoreMotion. Get started by reading the relevant section of the Event Handling Guide for iOS. You'll need to work with two classes: CMGyroData which encapsulates gyroscope event data, and CMMotionManager which is used to register for gyroscope events.

    More information can be found in this question's selected answer: Apple gyroscope sample code

提交回复
热议问题