
As a developer building iOS Cordova mobile apps that have forms I’ve come across the “shake to undo” feature multiple times. I’ve found this feature to usually popup when I’m least expecting it or want it to.
The nice thing is you can easily disable the “shake to undo” feature with a minor code update. Here’s how:
1. First, open the MainViewController.m file.
2. Find the function “webViewDidFinishLoad”.
3. Add one line of code before the return statement.
// disable shake to undo [UIApplication sharedApplication].applicationSupportsShakeToEdit = NO;
The final function looks like this:
- (void)webViewDidFinishLoad:(UIWebView*)theWebView { ... // disable shake to undo [UIApplication sharedApplication].applicationSupportsShakeToEdit = NO; return [super webViewDidFinishLoad:theWebView]; }
And thats it!
Anthony Montalbano
If it's worth doing, it's worth doing right.
Published on: January 1, 2015
Last modified on: December 8, 2021