-1
J'ai un ViewController qui fonctionne parfaitement avec un bouton qui déclenche une action. Je voudrais remplacer le bouton avec un événement tremblement donc je l'ai googlé autour et créé une classe de ShakeDetector qui ineherits de UIViewShake Detection iPhone 3.0 ne fonctionne pas
et ma mise en œuvre est la suivante:
@implementation ShakeDetector
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
}
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
if (motion == UIEventSubtypeMotionShake)
{
// User was shaking the device. Post a notification named "shake".
//[[NSNotificationCenter defaultCenter] postNotificationName:@"spin" object:self];
NSLog(@"sss");
}
}
- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
}
@end
Mais je ne peux pas le faire fonctionner ... toute aide?
Merci