Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mayur-tendulkar/a39a826af484cf7e06b5 to your computer and use it in GitHub Desktop.
Save mayur-tendulkar/a39a826af484cf7e06b5 to your computer and use it in GitHub Desktop.
Using Accelerometer in iOS Applications
public override void ViewDidLoad()
{
base.ViewDidLoad();
_motionManager = new CMMotionManager();
_motionManager.StartAccelerometerUpdates(NSOperationQueue.CurrentQueue, (data, error) =>
{
lblXAxis.Text = data.Acceleration.X.ToString("F");
lblYAxis.Text = data.Acceleration.Y.ToString("F");
lblZAxis.Text = data.Acceleration.Z.ToString("F");
});
// Perform any additional setup after loading the view, typically from a nib.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment