Most of the examples that I saw only connects NSSearchField
to an NSArrayController
. The problem is that I populated my NSTableView
using NSTableViewDataSource
protocol. I want my NSSearchField
to search on the given NSTableView
. Is there any way that I can do that or should I convert my datasource into an NSArray
Controller?
You can use an NSSearchField
without an array controller but you are responsible for handling the search and update of the table view.
Have your data source class respond to the ‑controlTextDidChange:
and/or the ‑controlTextDidEndEditing:
delegate methods of NSControl
(NSSearchField
is a subclass of NSControl
) and in those delegate method do your search and update the table accordingly.