| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.0 and later.
|
| Companion guide | |
| Declared in | NSTextFieldCell.h |
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.
Placeholder strings, set using setPlaceholderString: or setPlaceholderAttributedString:, 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.
– setPlaceholderString:
– placeholderString
– setPlaceholderAttributedString:
– placeholderAttributedString
Returns an array of locale identifiers representing input sources that are allowed to be enabled when the receiver has the keyboard focus.
- (NSArray *)allowedInputSourceLocales
The locale identifiers of allowed input sources.
NSTextFieldCell.h
Returns the color of the background the receiver draws behind the text.
- (NSColor *)backgroundColor
The background color of the text field cell.
– drawsBackground– backgroundColor (NSTextField)– setBackgroundColor:NSTextFieldCell.hReturns the receiver’s bezel style.
- (NSTextFieldBezelStyle)bezelStyle
A constant indicating the bezel style of the text field cell. See NSTextFieldBezelStyle.
NSTextFieldCell.h
Returns a Boolean value that indicates whether the receiver's cell draws its background color.
- (BOOL)drawsBackground
YES if the receiver’s cell draws its background color behind its text, NO if it draws no background.
– backgroundColor– drawsBackground (NSTextField)– setDrawsBackground:NSTextFieldCell.hReturns the cell’s attributed placeholder string.
- (NSAttributedString *)placeholderAttributedString
The attributed string used as the cell's placeholder.
NSTextFieldCell.hReturns the cell’s plain text placeholder string.
- (NSString *)placeholderString
The cell''s placeholder string.
NSTextFieldCell.hSets an array of locale identifiers representing input sources that are allowed to be enabled when the receiver has the keyboard focus.
- (void)setAllowedInputSourceLocales:(NSArray *)localeIdentifiers
The new locale identifiers of allowed input sources.
You can use the meta-locale identifier, NSAllRomanInputSourcesLocaleIdentifier, to specify input sources that are limited for Roman script editing.
NSTextFieldCell.h
Sets the color of the background that the receiver draws behind the text
- (void)setBackgroundColor:(NSColor *)aColor
The background color of the text field cell.
– setDrawsBackground:– setBackgroundColor: (NSTextField)– backgroundColorNSTextFieldCell.hSets the receiver’s bezel style.
- (void)setBezelStyle:(NSTextFieldBezelStyle)style
A constant specifying the bezel style of the text field cell. See NSTextFieldBezelStyle.
To set the bezel style, you must have already sent setBezeled: with an argument of YES.
NSTextFieldCell.h
Controls whether the receiver draws its background color behind its text.
- (void)setDrawsBackground:(BOOL)flag
YES if the receiver should draw its background color behind its text NO to draw nothing behind its text.
– setBackgroundColor:– setDrawsBackground: (NSTextField)– drawsBackgroundNSTextFieldCell.hSets the placeholder of the cell as an attributed string.
- (void)setPlaceholderAttributedString:(NSAttributedString *)string
The attributed string to use as a placeholder.
Note that invoking this successfully will clear out any plain text string set by setPlaceholderString:.
NSTextFieldCell.hSets the placeholder of the cell as a plain text string.
- (void)setPlaceholderString:(NSString *)string
The placeholder string.
Note that invoking this successfully will clear out any attributed string set by setPlaceholderAttributedString:.
NSTextFieldCell.h
Sets the color used to draw the receiver’s text.
- (void)setTextColor:(NSColor *)aColor
The color used to draw the text.
– setBackgroundColor:– setTextColor: (NSTextField)– textColorNSTextFieldCell.hSets up the field editor. You never invoke this method directly; by overriding it, however, you can customize or replace the field editor.
- (NSText *)setUpFieldEditorAttributes:(NSText *)textObj
When you override this method, you should generally invoke the implementation of super and return the textObj argument. For information on field editors, see “Using the Window’s Field Editor”.
NSTextFieldCell.hDirects the cell’s associated field editor to post text change notifications.
- (void)setWantsNotificationForMarkedText:(BOOL)flag
If YES, the field editor posts text change notifications (NSTextDidChangeNotification) while editing marked text; if NO, notifications are delayed until the marked text confirmation.
NSTextFieldCell.hReturns the color used to draw the receiver’s text.
- (NSColor *)textColor
The color used to draw the text.
– backgroundColor– textColor (NSTextField)– setTextColor:NSTextFieldCell.hSpecify the bezel style of the text field cell.
typedef enum {
NSTextFieldSquareBezel = 0,
NSTextFieldRoundedBezel = 1
} NSTextFieldBezelStyle;
NSTextFieldSquareBezelCorners are square.
Available in Mac OS X v10.2 and later.
Declared in NSTextFieldCell.h
NSTextFieldRoundedBezelCorners are rounded.
Available in Mac OS X v10.2 and later.
Declared in NSTextFieldCell.h
The bezel style of a text field is set using the bezelStyle and setBezelStyle: methods.
NSTextFieldCell.h
Last updated: 2007-04-16