简体   繁体   English

UITextField更改事件不会针对语音或粘贴的输入触发

[英]UITextField change event does not fire for speech or pasted input

在Xcode 6.2中,当尝试使用键盘上的“语音”按钮输入文本时触发UITextField“ Edited Changed”事件或“ Value Changed”事件触发时,它完美地使用了键入的输入, 但不适用于粘贴或输入的输入使用语音识别

You might want to use or hack another delegate shouldChangeCharactersInRange, it get called when text is changing 您可能想使用或修改另一个委托shouldChangeCharactersInRange,当文本更改时会调用它

- (BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{    
    // Do your stuff or raise a event when it is Pasted.
    // You can figure out if isPasted from the pattern of range.

    return YES;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM