我使用NSTextField的field editor调用它的自动完成
-(void)controlTextDidChange:(NSNotification *)notification {
NSTextView *fieldEditor = [[notification userInfo] objectForKey:@"NSFieldEditor"];
NSString *newValue = [fieldEditor string];
BOOL textDidNotChange = [lastTypedStreetValue isEqualToString:newValue];
if( textDidNotChange ){
return;
}
else {
lastTypedStreetValue = [newValue copy];
[fieldEditor complete:nil];
}
}如何设置此NSTextField的自动完成的字典
=如何将自动完成中弹出的单词设置为建议?
我有一个NSArray的词,我需要使用。
发布于 2022-10-19 12:02:06
谢谢您@Willeke,解决方案如下:
-(NSArray *) control:(NSControl*) control
textView:(NSTextView*) textView
completions:(NSArray*) words
forPartialWordRange:(NSRange) charRange
indexOfSelectedItem:(NSInteger*) index
{
NSArray *array = [methodThatCreatesTheWordList];
return array;
}https://stackoverflow.com/questions/74113216
复制相似问题