I want to use a custom keyboard for UIWebView. Custom keyboard should be all HTML/JS/CSS in order to use for multiple device. For this reason I added a notification like bellow:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow) name:UIKeyboardWillShowNotification object:nil];
In order to not allow the natural keyboard to comes up, I added following method when the notification is called.
- (void)keyboardWillShow
{
[self.webViews endEditing:YES];
}
In HTML file I have:
<!DOCTYPE>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>keyboard</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<div id="container">
<textarea id="write"></textarea>
</div>
</body>
</html>
The problem is, when I run this HTML file in UIWebView and have longpress on textarea, or double tap, it crashes the application.
If I remove [self.webViews endEditing:YES];
It won't crash the app but it brings up the keyboard.
I suspected to "copy/paste/select All" options on UIWebView when the user double tap or long press on textarea. I tried to disable them but it didn't work. Any idea would be appreciated.