Compartir a través de


CMDeviceMotionHandler Delegado

Definición

Firma de delegado usada para recibir eventos de CMMotionManager

public delegate void CMDeviceMotionHandler(CMDeviceMotion motion, NSError error);
type CMDeviceMotionHandler = delegate of CMDeviceMotion * NSError -> unit

Parámetros

motion
CMDeviceMotion

Movimiento del dispositivo para este evento (actitud, velocidad de rotación y aceleración para el dispositivo).

error
NSError

El error, si existe, o null si no hay errores que notificar.

Comentarios

Esta firma se usa como argumento para startDeviceMotionUpdates CMMotionManagerde .

Por ejemplo:

var motionManager = new CMMotionManager ();
motionManager.AccelerometerUpdateInterval = 0.01; // 100Hz
motionManager.StartDeviceMotionUpdates (NSOperationQueue.CurrentQueue, (motion, error) => {
     Console.WriteLine ("RotationRate={0} Gravity={1} UserAcceleration={2} Attitude={3}", motion.RotationRate, motion.Gravity, motion.UserAcceleration, motion.Attitude);
});

Se aplica a