ios摇一摇

时间:2023-03-09 02:44:26
ios摇一摇

-(void) motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event

{

if (motion==UIEventSubtypeMotionShake)

NSLog(@"Shake begin");

}

-(void) motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event

{

if (motion==UIEventSubtypeMotionShake)

NSLog(@"Shaked");

}

-(void) motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event

{

if (motion==UIEventSubtypeMotionShake)

NSLog(@"Shake cancel");

}