Ios 使用UIKeyInput提前输入问题
我有一个控制器,它接受自定义键输入并以独特的方式显示。它成为键响应器并实现Ios 使用UIKeyInput提前输入问题,ios,uikeyinput,Ios,Uikeyinput,我有一个控制器,它接受自定义键输入并以独特的方式显示。它成为键响应器并实现UIKeyInput 它是在8.0版本中实现的,比iOS键盘上的typeahead功能更早。我正在将其更新为10.0,但它无法很好地管理交互 - (void)deleteBackward { NSString *text = self.codedLabel.text; if (text.length > 0) { text = [text substringToIndex:text.length-
UIKeyInput
它是在8.0版本中实现的,比iOS键盘上的typeahead功能更早。我正在将其更新为10.0,但它无法很好地管理交互
- (void)deleteBackward {
NSString *text = self.codedLabel.text;
if (text.length > 0) {
text = [text substringToIndex:text.length-1];
}
self.codedLabel.text = text;
self.decodeLabel.text = [text stringByReplacingOccurrencesOfString:@"\n" withString:@" | "];
[self saveText:text];
}
- (BOOL)hasText {
NSString *text = self.codedLabel.text;
return (text.length > 0);
}
- (void)insertText:(NSString *)newtext {
NSString *text = self.codedLabel.text;
text = [text stringByAppendingString:newtext];
self.codedLabel.text = text;
self.decodeLabel.text = [text stringByReplacingOccurrencesOfString:@"\n" withString:@" | "];
[self saveText:text];
}
选择一个提前键入的单词时,将调用insertText:
,但newtext
值始终为0xa000000000000201
,并且调试输出为
(lldb) po newtext
(lldb) p newtext.length
(NSUInteger) $1 = 1