je suis en utilisant le code suivant, mais continue à me donner 0 valeurs s'il vous plaît vérifier ce que je fais malObjectif c - l'attitude de mouvement de l'appareil valeurs
UILabel *rollLabel = [[UILabel alloc] init];
CMQuaternion quat = self.motionManager.deviceMotion.attitude.quaternion;
float myRoll = radiansToDegrees(atan2(2*(quat.y*quat.w - quat.x*quat.z), 1 - 2*quat.y*quat.y - 2*quat.z*quat.z)) ;
float myPitch = radiansToDegrees(atan2(2*(quat.x*quat.w + quat.y*quat.z), 1 - 2*quat.x*quat.x - 2*quat.z*quat.z));
float myYaw = radiansToDegrees(asin(2*quat.x*quat.y + 2*quat.w*quat.z));
[rollLabel setText:[NSString stringWithFormat:@"ROLL = %f , - Pitch = %f, , - Yaw = %f", myRoll, myPitch, myYaw]];
rollLabel.frame = CGRectMake(0, 0, 400, 150);
rollLabel.backgroundColor=[UIColor greenColor];
rollLabel.textColor=[UIColor blackColor];
[self.view addSubview:rollLabel];
merci pour votre aide
toute aide sera reconnaissant – user460024
Comment vous 'self.motionManager' initialiser? – Losiowaty
@property (non atomique, fort) CMMotionManager * motionManager; – user460024