< Previous PageNext Page > Hide TOC

Adding a Search Field to Your Application

You can create a search field programatically, but the easiest way to add a search field to your application is to use Interface Builder. Simply drag a search field from the Cocoa-Text palette to your window. and add it to a window.

Use the Attributes pane of the Show Info panel to set search-field-specific attributes:

You can connect the a search field to a menu template. The details of the menu’s contents are described in “Configuring a Search Menu.”

You need to configure the targets and actions of the search field. This is described in “Implementing the Target.”

You can also specify that the search field use a controller to perform searches. In the Bindings pane, disclose the value binding and select the controller to bind to as well as the controller’s key. In the Connections pane, make sure the correct target and action pair is selected. Additional information about using controllers can be found in Cocoa Bindings Programming Topics.



< Previous PageNext Page > Hide TOC


© 2003, 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-02-08)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.