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?
Asked
Active
Viewed 3,712 times
4

Justin Boo
- 10,132
- 8
- 50
- 71

AdonisDee
- 60
- 2
- 6
1 Answers
6
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.

Rob Keniger
- 45,830
- 6
- 101
- 134
-
Thanks for the response. This can actually solve the problem but the client wants to use apple's zero code searching using the NSSearchfield. What I did was to convert my datasource into an NSArray controller. Thanks again for the help. – AdonisDee Jun 21 '11 at 02:59