- (void)startMotion {
?????? self.motionManager = [[CMMotionManager alloc]init];
?????? if (self.motionManager.accelerometerAvailable) {
?????? [_motionManager setAccelerometerUpdateInterval:1/5.f];
?????? NSOperationQueue *operationQueue = [NSOperationQueue mainQueue];
?????? __weak typeof(self) wSelf = self;
?????? [_motionManager startAccelerometerUpdatesToQueue:operationQueue withHandler:^(CMAccelerometerData???? *data,NSError *error)
?????? {
????????????? double x = data.acceleration.x;
????????????? double y = data.acceleration.y;
????????????? double z = data.acceleration.z;
????????????? if (fabs(z) < 1.0) {
?????????????????? if (fabs(y) > 0.1) {
?????????????????? if (y > 0){
?????????????????????????? NSLog(@"左");
?????????????????? } else{
????????????????????????? NSLog(@"右");
????????????????? }
??????????? } else if (fabs(x) > 0.15) {
??????????????? if (x > 0) {
??????????????????????? NSLog(@"上");
??????????????? } else{
?????????????????????? NSLog(@"下");
?????????????? }
???????? }
???? }
???? }];
?}
}