Class

NSTextFieldCell

An object that enhances the text display capabilities of a cell.

Declaration

@interface NSTextFieldCell : NSActionCell

Overview

The NSTextFieldCell class adds to the text display capabilities of the NSCell class by allowing you to set the color of both the text and its background. You can also specify whether the cell draws its background at all.

All of the methods declared by this class are also declared by the NSTextField class, which uses NSTextFieldCell objects to draw and edit text. These NSTextField cover methods call the corresponding NSTextFieldCell methods.

Placeholder strings, set using the placeholderString or placeholderAttributedString property, now appear in the text field cell if the actual string is nil or @"". They are drawn in grey on the cell and are not archived in the “pre-10.2” nib format.

Designated Initializers

When subclassing NSTextFieldCell you must implement all of the designated initializers. Those methods are: initWithCoder:, initTextCell:, and initImageCell:.

Topics

Setting the Text Color

textColor

The color used to draw the cell’s text.

Setting the Bezel Style

bezelStyle

The bezel style to use when drawing the text field.

Controlling the Background

backgroundColor

The color of the cell’s background.

drawsBackground

A Boolean value indicating whether the cell draws its background color.

Managing the Field Editor

- setUpFieldEditorAttributes:

Sets up the field editor. You never invoke this method directly; by overriding it, however, you can customize the field editor.

- setWantsNotificationForMarkedText:

Directs the cell’s associated field editor to post text change notifications.

Managing Placeholder Strings

placeholderString

The placeholder text for the cell, specified as a plain text string.

placeholderAttributedString

The placeholder text for the cell, specified as an attributed string.

Accessing Input Source Locales

allowedInputSourceLocales

An array of locale identifiers representing the allowed input sources when the text field has the keyboard focus.

Constants

NSTextFieldBezelStyle

Specify the bezel style of the text field cell.

Relationships

Inherits From

See Also

Cell

NSSecureTextFieldCell

A text field whose value is hidden from the user.