问题描述
我在 ios 5 中使用了 uiwebview.我尝试设置 contenteditable="true" 以使 uiwebview 可编辑.
我的应用程序的屏幕截图类似于此链接中的图像 .
<小时>这是一个灰色地带,但肯定有可能.
见这里:http://ios-blog.co.uk/iphone-development-tutorials/rich-text-editing-a-simple-start-part-1/
注册键盘显示通知:
[[nsnotificationcenter defaultcenter] addobserver:self 选择器:@selector(keyboardwillshow:) name:uikeyboardwillshownotification object:nil];
然后:
- (void)keyboardwillshow:(nsnotification *)note {[self performselector:@selector(removebar) withobject:nil afterdelay:0];}- (void)removebar {//定位非 uiwindow.uiwindow *keyboardwindow = nil;for (uiwindow *testwindow in [[uiapplication sharedapplication] windows]) {if (![[testwindow class] isequal:[uiwindow class]]) {键盘窗口 = 测试窗口;休息;}}//定位 uiwebformview.for (uiview *possibleformview in [keyboardwindow subviews]) {//ios 5 将 uiwebformview 粘贴在 uiperipheralhostview 中.if ([[possibleformview 描述] rangeofstring:@"uiperipheralhostview"].location != nsnotfound) {for (uiview *subviewwhichispossibleformview in [possibleformview subviews]) {if ([[subviewwhichispossibleformview 描述] rangeofstring:@"uiwebformaccessory"].location != nsnotfound) {[subviewwhichispossibleformview removefromsuperview];}}}}}
i have use a uiwebview in ios 5. i try to set contenteditable="true" to make uiwebview editable.
the screenshoot of my app is similar to an image in this link how do you remove the next and prev buttons from virtual keyboard in sencha touch / phonegap application,
my problem is i want to remove this prev & next button from the keyboard, but i dont know how. can some body help me?
thank you
this is an old answer and is no longer working on ios 9. for an updated solution, see my answer here.
it is a gray-area, but certainly possible.
see here: http://ios-blog.co.uk/iphone-development-tutorials/rich-text-editing-a-simple-start-part-1/
register for notification on keyboard showing:
[[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(keyboardwillshow:) name:uikeyboardwillshownotification object:nil];
then:
- (void)keyboardwillshow:(nsnotification *)note { [self performselector:@selector(removebar) withobject:nil afterdelay:0]; } - (void)removebar { // locate non-uiwindow. uiwindow *keyboardwindow = nil; for (uiwindow *testwindow in [[uiapplication sharedapplication] windows]) { if (![[testwindow class] isequal:[uiwindow class]]) { keyboardwindow = testwindow; break; } } // locate uiwebformview. for (uiview *possibleformview in [keyboardwindow subviews]) { // ios 5 sticks the uiwebformview inside a uiperipheralhostview. if ([[possibleformview description] rangeofstring:@"uiperipheralhostview"].location != nsnotfound) { for (uiview *subviewwhichispossibleformview in [possibleformview subviews]) { if ([[subviewwhichispossibleformview description] rangeofstring:@"uiwebformaccessory"].location != nsnotfound) { [subviewwhichispossibleformview removefromsuperview]; } } } } }