iPhone Shake event not properly working
问题 I have this inside my viewController: - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { if (event.type == UIEventSubtypeMotionShake) { NSLog(@"I have shaked"); } } Why is this not working? Edit: I do infact have this: - (void) viewWillAppear:(BOOL)animated { [shakeView becomeFirstResponder]; [super viewWillAppear:animated]; } - (void) viewWillDisappear:(BOOL)animated { [shakeView resignFirstResponder]; [super viewWillDisappear:animated]; } 回答1: If the UIViewController is