I've bound the NSComboBox bounded to a data source within interface builder. I correctly get the autocomplete suggestions, when I type something in the NSComboBox.
However the autocomplete is case sensitive, which means I don't get suggestion if the character uses the wrong case.
How can I enable case insensitive autocomplete for a NSComboBox, which is bound to the data source in interface builder ?
Thanks
You should implement comboBox:completedString:
in your NSComboBox Data Source, e.g:
- (NSString *)comboBox:(NSComboBox *)comboBox completedString:(NSString *)partialString
{
for (NSString dataString in dataSourceArray) {
if ([[dataString commonPrefixWithString:partialString options:NSCaseInsensitiveSearch] length] == [commonPrefixWithString:partialString length]) {
return testItem;
}
}
return @"";
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With