In this recipe, we will learn how to use the device's built-in gyroscope.
Perform the following steps:
Add two buttons and a label to the view the controller.
Add the
MonoTouch.CoreMotion
namespace in theGyroscopeAppViewController.cs
file.Enter the following private field in the class:
private CMMotionManager motionManager;
Implement the
ViewDidLoad
method with the following code:this.motionManager = new CMMotionManager(); this.motionManager.GyroUpdateInterval = 1 / 10; this.btnStart.TouchUpInside += delegate { this.motionManager.StartGyroUpdates(NSOperationQueue.MainQueue, this.GyroData_Received); } ; this.btnStop.TouchUpInside += delegate { this.motionManager...