0

I have to measure continues SHAKE in event into my application. As Accelerometer is deprecated, so I am using CoreMotion. I am using following code into my application.

- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
    if (event.type == UIEventTypeMotion && event.subtype == UIEventSubtypeMotionShake) {
        NSLog(@"Shaking...");
    }
}

Its detect the event when I stop the Shake. Is there any way through which I can detect continues shake event ?

Thanks in advance.

Nirmalsinh Rathod
  • 5,079
  • 4
  • 26
  • 56
  • Have you just tried with `if ( event.subtype == UIEventSubtypeMotionShake )` ?? and also read http://stackoverflow.com/questions/150446/how-do-i-detect-when-someone-shakes-an-iphone – iPatel May 30 '14 at 05:53
  • Yupp, I had tried with it also. But its comes when we stop the shaking. I want continues shaking event. – Nirmalsinh Rathod May 30 '14 at 07:57

1 Answers1

0

Can't you use the motionBegan method?

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
    if (event.type == UIEventTypeMotion && event.subtype == UIEventSubtypeMotionShake) {
        NSLog(@"Shaking...");
    }
}
Stefan
  • 5,203
  • 8
  • 27
  • 51