I’ve been searching for hours and still haven’t found an answer to this. How can you get an NSSearchField to display a menu with results. I can use the recent searches menu to display results, but how do I make the menu display programmatically? Thanks for any help.
I’ve been searching for hours and still haven’t found an answer to this. How
Share
I believe Apple does this with some private methods. Maybe it uses an
NSWindowinstead of anNSMenu. One way to do it is to implement this in yourNSSearchFielddelegate assuming you have anIBOutletpointing to theNSSearchField.Note that showing a menu prevents further typing in the
NSSearchField. That’s why I usedcontrolTextDidEndEditing:and notcontrolTextDidChange:. You should also check NSEvent’s Class Reference for more customization of the event.