iOS键盘扩展:工作太多如果没有完全访问权限,则会很慢

时间:2014-12-13 05:10:16

标签: input ios8 xcode6 custom-keyboard

我正在研究自定义键盘每一件工作正常但面临奇怪的问题。我觉得当我按下我的自定义键盘的任何键(如果没有完全访问权限)时会触发一些延迟的事件。我的代码是

- (void)viewDidLoad 
  {
    [super viewDidLoad];
    [self addGestureTokeybaord];
  }
-(void)addGestureTokeybaord
 {
    [self.keyboard.deletekey addTarget:self action:@selector(pressDeletekey) forControlEvents:UIControlEventTouchUpInside];
    [self.keyboard.spacekey addTarget:self action:@selector(pressSpacekey) forControlEvents:UIControlEventTouchUpInside];
     [self.keyboard.returnkey addTarget:self action:@selector(pressReturnkey) forControlEvents:UIControlEventTouchUpInside];
    [self.keyboard.donekey addTarget:self action:@selector(dismissKeyboard) forControlEvents:UIControlEventTouchUpInside];

    [self.keyboard.globalkey addTarget:self action:@selector(advanceToNextInputMode) forControlEvents:UIControlEventTouchUpInside];




    [self.keyboard.shiftkey addTarget:self action:@selector(unShift) forControlEvents:UIControlEventTouchUpInside];
    [self.keyboard.shiftkeyright addTarget:self action:@selector(unShift) forControlEvents:UIControlEventTouchUpInside];

     [self.keyboard.numberskey addTarget:self action:@selector(pressNumberskey) forControlEvents:UIControlEventTouchUpInside];

    for (UIButton *key in self.keyboard.keysArray) {
        [key addTarget:self action:@selector(pressKey:) forControlEvents:UIControlEventTouchUpInside];
    }
}
-(void)pressKey:(UIButton *)key
{
  [[UIDevice currentDevice] playInputClick];
   [self.textDocumentProxy insertText:[key currentTitle]];
 }

如何在没有任何延迟的情况下发射我的事件(如果没有完全访问权限)。任何建议将不胜感激。 感谢

1 个答案:

答案 0 :(得分:0)

[[UIDevice currentDevice] playInputClick];

让你拖延。 只需用完全访问权限进行包装即可。