如何从虚拟键盘IOS中删除prev next按钮 [英] how to remove prev next button from virtual keyboard IOS

查看:125
本文介绍了如何从虚拟键盘IOS中删除prev next按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在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:@ selector(keyboardWillShow :) name:UIKeyboardWillShowNotification object:nil]; 

然后:

   - (void)keyboardWillShow:(NSNotification *)note {
[self performSelector:@selector(removeBar)withObject:nil afterDelay:0];
}

- (void)removeBar {
//找到非UIWindow。
UIWindow * keyboardWindow = nil;
。对于(一个UIWindow *在[[UIApplication的sharedApplication]视窗] testWindow){
如果([[testWindow类] isEqual:方法[UIWindow类]]!){
keyboardWindow = testWindow;
休息;
}
}

//找到UIWebFormView。
for([keyboardWindow subviews]中的UIView * possibleFormView){
// iOS 5将UIWebFormView粘贴在UIPeripheralHostView中。
如果([[possibleFormView描述] rangeOfString:@ UIPeripheralHostView]!位置= NSNotFound){
为(UIView的*在[possibleFormView子视图] subviewWhichIsPossibleFormView){
如果([[subviewWhichIsPossibleFormView descriptionOfString:@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];
                }
            }
        }
    }
}

这篇关于如何从虚拟键盘IOS中删除prev next按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆