Mac OS X Reference Library Apple Developer Connection spyglass button

NSTokenField Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in Mac OS X v10.4 and later.
Companion guide
Declared in
NSTokenField.h

Overview

NSTokenField is a subclass of NSTextField that provides tokenized editing similar to the address field in the Mail application.

NSTokenField uses an NSTokenFieldCell to implement much of the control’s functionality. NSTokenField provides cover methods for most methods of NSTokenFieldCell, which invoke the corresponding cell method.

Notes: In Mac OS X v10.4 and earlier, represented objects associated with token fields had to conform to NSCoding. Starting with Mac OS X v10.5, they no longer need to.

In Mac OS X v10.4, NSTokenField trims whitespace around tokens but it does not trim whitespace in Mac OS X versions 10.5.0 and 10.5.1. In Mac OS X v10.5.2, you get whitespace-trimming behavior by either linking against the v10.4 binary or linking against the v10.5 binary and not implementing the tokenField:representedObjectForEditingString: method. If you do not want the whitespace-trimming behavior, link against the v10.5 binary and implement this method, returning the editing string if you have no represented object.

Tasks

Configuring the Token Style

Configuring the Tokenizing Character Set

Configuring the Completion Delay

Getting and Setting the Delegate

Class Methods

defaultCompletionDelay

Returns the default completion delay.

+ (NSTimeInterval)defaultCompletionDelay

Discussion

The default completion delay is 0.

Availability
Declared In
NSTokenField.h

defaultTokenizingCharacterSet

Returns the default tokenizing character set.

+ (NSCharacterSet *)defaultTokenizingCharacterSet

Discussion

The default tokenizing character set is “,”.

Availability
Declared In
NSTokenField.h

Instance Methods

completionDelay

Returns the receiver’s completion delay.

- (NSTimeInterval)completionDelay

Availability
  • Available in Mac OS X v10.4 and later.
See Also
Declared In
NSTokenField.h

delegate

Returns the token field’s delegate.

- (id < NSTokenFieldDelegate >)delegate

Return Value

The token field’s delegate

Availability
  • Available in Mac OS X v10.6 and later.
See Also
Declared In
NSTokenField.h

setCompletionDelay:

Sets the receiver’s completion delay.

- (void)setCompletionDelay:(NSTimeInterval)delay

Availability
  • Available in Mac OS X v10.4 and later.
See Also
Declared In
NSTokenField.h

setDelegate:

Sets the token field’s delegate

- (void)setDelegate:(id < NSTokenFieldDelegate >)anObject

Parameters
anObject

The delegate for the receiver. The delegate must conform to the NSTokenFieldDelegate Protocol protocol.

Availability
  • Available in Mac OS X v10.6 and later.
See Also
Declared In
NSTokenField.h

setTokenizingCharacterSet:

Sets the recevier’s tokenizing character set to characterSet.

- (void)setTokenizingCharacterSet:(NSCharacterSet *)characterSet

Availability
  • Available in Mac OS X v10.4 and later.
See Also
Declared In
NSTokenField.h

setTokenStyle:

Returns the token style of the receiver.

- (void)setTokenStyle:(NSTokenStyle)style

Availability
  • Available in Mac OS X v10.4 and later.
See Also
Declared In
NSTokenField.h

tokenizingCharacterSet

Returns the receiver’s tokenizing character set.

- (NSCharacterSet *)tokenizingCharacterSet

Availability
  • Available in Mac OS X v10.4 and later.
See Also
Declared In
NSTokenField.h

tokenStyle

Returns the receiver’s token style.

- (NSTokenStyle)tokenStyle

Availability
  • Available in Mac OS X v10.4 and later.
See Also
Declared In
NSTokenField.h


Last updated: 2009-05-24

Did this document help you? Yes It's good, but... Not helpful...