【问题标题】:iOS Keyboard extension: working too much Slow if no full accessiOS键盘扩展:如果没有完全访问权限,工作太慢
【发布时间】:2015-02-11 21:07:05
【问题描述】:

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

- (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]];
 }

我怎样才能毫不拖延地触发我的事件(如果没有完全访问权限)。?任何建议将不胜感激。 谢谢

【问题讨论】:

    标签: input ios8 xcode6 custom-keyboard


    【解决方案1】:
    [[UIDevice currentDevice] playInputClick];
    

    耽误你的时间。 只需使用完全访问检查包装即可。

    【讨论】:

      猜你喜欢
      • 2014-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-17
      • 2015-05-21
      • 2022-08-19
      相关资源
      最近更新 更多