I succesfully implemented the shake gesture, but now I would like to limit it to activate only in one specific situation (in the options panel of my app).
-
I first created ShakeWindow class which is a subclass of UIWindow. In ShakeWindow I added
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)eventto register shake gesture. -
Next I went to AppDelegate.m and edited
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];to use the new ShakeWindow instead of UIWindow.
It works great, but how do I limit it’s functionality? I’m just starting Objective-C and consider myself as a novice coder overall so keep that in mind when answering, thank you!
I use Cocos2D as the framework and I don’t use Interface Builder if those matter.
I might be misunderstanding, but how about…