文本字段位于iOS 8的UIWebView中的自定义键盘下 [英] Text field stays under the custom keyboard in UIWebView for iOS 8

查看:104
本文介绍了文本字段位于iOS 8的UIWebView中的自定义键盘下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为iOS创建一个Web应用程序,并且有一个自定义键盘.当我使用默认键盘时,它将立即显示键盘,并且文本字段在键盘上方.如果将键盘更改为自定义键盘,我将得到相同的结果.但是问题出在启用自定义键盘时,我将焦点集中在文本字段上.加载有一些延迟,加载时,文本字段停留在键盘下方.这是我的自定义键盘密码:

I'm creating a web App for iOS and I have a custom keyboard. When I use the default keyboard, it immediately shows the keyboard and the text field is above the keyboard. I would have the same result if I change the keyboard to my custom keyboard. But the problem is for the time that I gives the focus to the text field when my custom keyboard is enabled. It has some delay to load and when it loads, text field stays under the keyboard. Here is my code for custom keybaord:

#import "KeyboardViewController.h"
#import "CustomKeyboardView.h"

@interface KeyboardViewController () <CustomKeyboardViewDelegate>
@property (nonatomic, strong) CustomKeyboardView *customKeyboardView;
@end

@implementation KeyboardViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.customKeyboardView = [[CustomKeyboardView alloc] init];
    self.inputView = (UIInputView *) self.customKeyboardView;

    self.customKeyboardView.delegate = self;
}


- (void)handleCharacter:(NSString *)character sender:(CustomKeyboardView *)sender
{
    [self.textDocumentProxy insertText:character];
}

-(void)handelDelete:(CustomKeyboardView *)sender
{
    [self.textDocumentProxy deleteBackward];
}
-(void)handleDismissKeyboard:(CustomKeyboardView *)sender
{
    [self dismissKeyboard];
}
-(void)handleChangeKeyboard:(CustomKeyboardView *)sender
{
    [self advanceToNextInputMode];
}


- (void)textWillChange:(id<UITextInput>)textInput {
    // The app is about to change the document's contents. Perform any preparation here.
}

- (void)textDidChange:(id<UITextInput>)textInput {
    // The app has just changed the document's contents, the document context has been updated.
    [[NSNotificationCenter defaultCenter] postNotificationName:UITextViewTextDidChangeNotification object:textInput];
}

@end

CustomKeyboardView类的实现类似于库.任何帮助将不胜感激.

The implementation of CustomKeyboardView class is similar to this library. Any help would be appreciated.

推荐答案

尝试使用后台线程,由于您在首先构建键盘视图之前执行了大量代码,因此会产生延迟.

Try use the background threads, you have a delay because u execute a lot of code before you build your keyboard view first.

这篇关于文本字段位于iOS 8的UIWebView中的自定义键盘下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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