ID 한 방향으로 흔들면 한 가지, 다른 방향으로 흔들면 ID가있는 앱을 사용합니다.가속도계가 좌우로 움직이는 것을 감지 함 - 방향 변경의 즉각적인 감지
atm 제 코드는입니다.
if (acceleration.x > 1.5) {
오른쪽 // 암 1 개 -1 값이 너무 민감하지에 노력하고 있습니다 당신에게
float duration = ([imageArray count]*0.04);
//HUMAN EYE KEEPS IMAGES IN EYE For 40 MILLISECONDS//
//NSLog(@"duration:%f", duration);
[theFlash setAnimationImages:imageArray];
[theFlash setAnimationRepeatCount:1];
theFlash.animationDuration = duration;
[theFlash startAnimating];
NSLog(@"images flashed forward");
}
if (acceleration.x < -1)
{
//arm to the left when facing you
float duration = ([imageArrayReversed count]*0.04);
//HUMAN EYE KEEPS IMAGES IN EYE For 40 MILLISECONDS//
NSLog(@"duration:%f", duration);
[theFlash setAnimationImages:imageArrayReversed];
[theFlash setAnimationRepeatCount:1];
theFlash.animationDuration = duration;
[theFlash startAnimating];
NSLog(@"images flashed backward");
}
에 직면.
그러나이 코드는 원하는 결과를 제공하지 않습니다. 사람이 장치를 다른 방향으로 움직이기 시작하면 이미지 (예 : 코드 참조)가 좋아요.
이 작업을 수행하는 방법은 무엇입니까?
설명 ... 감속을 시작하기보다는 주변을 돌아볼 때 장치의 속도가 0이되면 이미지가 깜박입니까? –
음, 그렇습니다. 돌아서. 순간적으로 장치는 v = 0이 될 것입니다. 이것은 효과적인 방아쇠가 될 수 있습니다. 어떻게 사용합니까? –