Skip to content

Instantly share code, notes, and snippets.

@lbj96347
Created September 11, 2012 05:08
Show Gist options
  • Select an option

  • Save lbj96347/3696091 to your computer and use it in GitHub Desktop.

Select an option

Save lbj96347/3696091 to your computer and use it in GitHub Desktop.
Phonegap Keyboard Auto Hide
/* This file concludes native code and javascript code and u just need to paste native code into your phonegap plugin */
/* native code part */
/* keyboard auto hide solution */
- (void) hideKeyboard:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
{
//UIButton *button = [UIButton
buttonWithType:UIButtonTypeRoundedRect;
NSLog(@"hideKeyboard is being called");
[self.webView endEditing:YES];
}
/* javascript part */
function hideKeyboard(){
console.log("关闭键盘");
cordova.exec("ChildBrowserCommand.hideKeyboard", "隐藏键盘");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment