0

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

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

Albert Renshaw
  • 17,282
  • 18
  • 107
  • 195
Hamid
  • 2,852
  • 1
  • 28
  • 45
  • 1
    This delay of displaying a custom keyboard is happening to everyone. I do not know of a fix, I suspect it will be fixed in iOS8 GM release. It's probably just laggy for now for debugging purposes. – Albert Renshaw Aug 10 '14 at 04:14
  • This is fixed in iOS 8 beta5 – Ezimet Aug 15 '14 at 23:42

1 Answers1

0

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

tatiana_c
  • 948
  • 7
  • 16
  • 31
  • When should I trigger the keyboard thread? Would you please explain a little bit more with some sample? – Hamid Aug 26 '14 at 15:28