TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Daniel Haight.
A tiny category, with a single method to send out a NSNotifiatication if a shake is detected :)
add contents of DHCShakeNotifier
to your project
Clone/ download the repo and take a quick look at the demo.
import DHCShakeNotifier:
#import "UIWindow+DHCShakeRecognizer.h"
listen for shake notification by adding an NSNotification observer :
@implementation YourObject
...
-(id)init{
if (self==[super init]) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(methodThatIsCalledAfterShake) name:@"CONJUShakeNotification" object:nil];
}
return self;
}
...
-(void)methodThatIsCalledAfterShake{
NSLog(@"\"I have just been shaken\" - A martini after being ordered by James Bond");
}
...
-(void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self name:DHCSHakeNotifName object:nil];
}
...
@end