I invoke autocomplete on a NSTextField by using it's 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];
}
}
How do I set the dictionary for the autocomplete of this NSTextField?
= How do I set the words that pop up as suggestions in the autocomplete?
I have an NSArray of words I need to use.
Thank you @Willeke, the solution looks as follows: