Next Page > Hide TOC

NSSearchField Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in Mac OS X v10.3 and later.
Companion guide
Declared in
NSSearchField.h
Related sample code

Overview

An NSSearchField object implements a text field control that is optimized for performing text-based searches. The control provides a customized text field for entering search data, a search button, a cancel button, and a pop-up icon menu for listing recent search strings and custom search categories.

An NSSearchField object wraps an NSSearchFieldCell object. Access to most search field attributes occurs through the cell, which provides a more comprehensive programmatic interface for manipulating the search field. You can use an NSSearchField object though to manipulate some aspects of the search field. For additional information about search fields and how to manipulate them, see the NSSearchFieldCell class.

Tasks

Managing Recent Searches

Managing Autosave Name

Instance Methods

recentsAutosaveName

Returns the key under which the prior list of recent search strings has been archived.

- (NSString *)recentsAutosaveName

Return Value

The autosave name, which is used as a key in the standard user defaults to save the recent searches. The default value is nil, which causes searches not to be autosaved.

Availability
See Also
Declared In
NSSearchField.h

recentSearches

Returns the list of recent search strings for the control.

- (NSArray *)recentSearches

Return Value

An array of NSString objects, each of which contains a search string either displayed in the search menu or from a recent autosave archive. If there have been no recent searches and no prior searches saved under an autosave name, this array may be empty.

Availability
See Also
Declared In
NSSearchField.h

setRecentsAutosaveName:

Sets the autosave name under which the receiver automatically archives the list of recent search strings.

- (void)setRecentsAutosaveName:(NSString *)name

Parameters
name

The autosave name, which is used as a key in the standard user defaults to save the recent searches. If you specify nil or an empty string for this parameter, no autosave name is set and searches are not autosaved.

Availability
See Also
Declared In
NSSearchField.h

setRecentSearches:

Sets the list of recent search strings to list in the pop-up icon menu of the receiver.

- (void)setRecentSearches:(NSArray *)searches

Parameters
searches

An array of NSString objects containing the search strings.

Discussion

You might use this method to set the recent list of searches from an archived copy.

Availability
See Also
Declared In
NSSearchField.h

Next Page > Hide TOC


© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)


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.