IOS shake, iOS
-(Void) viewDidLoad {[super viewDidLoad]; [[UIApplication sharedApplication] setApplicationSupportsShakeToEdit: YES]; // sets whether redo and undo operations are supported when a shake occurs. The default value is yes, therefore, this statement can be left blank: [self becomeFirstResponder]; // set the current controller to the first responder, only the first responder can respond to the trigger event of a shake.} // The response method when the shake starts.-(void) motionBegan :( UIEventSubtype) motion withEvent :( UIEvent *) event {NSLog (@ "start shaking");} // The response method when the shaking is canceled (for example, if a call comes in and the call is canceled)-(void) motionCancelled :( UIEventSubtype) motion WithEvent :( UIEvent *) event {NSLog (@ "");} // response method when the shake ends-(void) motionEnded :( UIEventSubtype) motion withEvent :( UIEvent *) event {if (motion! = UIEventSubtypeMotionShake) {// determines whether the gesture is a shaking gesture return;} self. view. backgroundColor = [UIColor redColor]; NSLog (@ "Shake end ");}