如何从虚拟键盘IOS中删除prev next按钮

R. *_*ewi 6 keyboard objective-c next uiwebview ios5

我在IOS 5中使用了UIWebview.我尝试设置contenteditable="true"使uiwebview可编辑.

我的应用程序的屏幕截图类似于此链接中的图像如何从Sencha Touch/Phonegap应用程序中的虚拟键盘中删除Next和Prev按钮,

在此输入图像描述

我的问题是我想从键盘上删除这个prev&next按钮,但我不知道如何.有些身体可以帮助我吗?

谢谢

Leo*_*ica 11

这是一个古老的答案,不再工作在iOS 9.对于更新的解决方案,请参阅我的答案在这里.


这是一个灰色地带,但肯定是可能的.

见这里: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];
Run Code Online (Sandbox Code Playgroud)

然后:

- (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];
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)