Created
November 19, 2013 18:13
-
-
Save casspangell/7549784 to your computer and use it in GitHub Desktop.
Detect Shake in iOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
[self becomeFirstResponder]; // set this view as first responder | |
} | |
-(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event { | |
if(event.type == UIEventSubtypeMotionShake){ | |
NSLog(@"SHAKE"); | |
} | |
} | |
- (BOOL)canBecomeFirstResponder | |
{ | |
return YES; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment