| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.0 and later. |
| Companion guide | |
| Declared in | NSFormCell.h |
| Related sample code |
The NSFormCell class is used to implement text entry fields in a form. The left part of an NSFormCell object contains a title. The right part contains an editable text entry field.
An NSFormCell object implements the user interface of an NSForm object.
– attributedTitle
– title
– titleAlignment
– titleBaseWritingDirection
– titleFont
– titleWidth
– titleWidth:
– setAttributedTitle:
– setTitle:
– setTitleAlignment:
– setTitleBaseWritingDirection:
– setTitleFont:
– setTitleWidth:
– placeholderAttributedString
– placeholderString
– setPlaceholderAttributedString:
– setPlaceholderString:
Returns the title of the cell as an attributed string.
- (NSAttributedString *)attributedTitle
The title of the cell.
NSFormCell.h
Returns an NSFormCell object initialized with the specified title string.
- (id)initTextCell:(NSString *)aString
The title for the new form cell object.
An initialized NSFormCell object.
The contents of the cell's editable text entry field are set to the empty string (@“”). The font for both title and text is the user’s chosen system font in 12.0 point, and the text area is drawn with a bezel. This method is the designated initializer for the NSFormCell class.
NSFormCell.hReturns a Boolean value indicating whether the title is empty and an opaque bezel is set.
- (BOOL)isOpaque
YES if the title is empty and an opaque bezel is set; otherwise, NO.
NSFormCell.hReturns the cell’s attributed placeholder string.
- (NSAttributedString *)placeholderAttributedString
The attributed placeholder string, or nil if the cell has no attributed placeholder string.
If this method returns nil, you can also call placeholderString to see if the cell has a plain text placeholder string.
NSFormCell.hReturns the cell’s plain text placeholder string.
- (NSString *)placeholderString
The plain-text placeholder string, or nil if the cell has no plain-text placeholder string.
If this method returns nil, you can also call placeholderAttributedString to see if the cell has an attributed placeholder string.
NSFormCell.h
Sets the receiver’s title using an attributed string.
- (void)setAttributedTitle:(NSAttributedString *)anAttributedString
The formatted title of the cell.
NSFormCell.hSets the attributed placeholder string for the cell.
- (void)setPlaceholderAttributedString:(NSAttributedString *)string
The attributed placeholder string.
Note that invoking this method clears out any plain text string set by calling the setPlaceholderString: method.
NSFormCell.hSets the plain-text placeholder string for the cell.
- (void)setPlaceholderString:(NSString *)string
The plain-text placeholder string.
Note that invoking this method clears out any attributed string set by the setPlaceholderAttributedString: method.
NSFormCell.hSets the receiver’s title to the specified plain-text string.
- (void)setTitle:(NSString *)aString
The plain-text title of the cell.
NSFormCell.h
Sets the alignment of the title.
- (void)setTitleAlignment:(NSTextAlignment)alignment
The alignment can be one of the following constants: NSRightTextAlignment, NSCenterTextAlignment, or NSLeftTextAlignment.
NSFormCell.hSets the default writing direction used to render the form cell’s title.
- (void)setTitleBaseWritingDirection:(NSWritingDirection)writingDirection
This value can be one of the following constants: NSWritingDirectionNatural, NSWritingDirectionLeftToRight, or NSWritingDirectionRightToLeft.
NSFormCell.h
Sets the font of the receiver's title.
- (void)setTitleFont:(NSFont *)font
The font to use.
NSFormCell.hSets the width of the title.
- (void)setTitleWidth:(CGFloat)width
The width of the title, measured in points in the user coordinate space.
You usually do not need to invoke this method. The Application Kit automatically sets the title width whenever the title changes. If the automatic width doesn’t suit your needs, though, you can use this method to set the width explicitly.
Once you have set the width this way, the Application Kit stops setting the width automatically; you must invoke this method every time the title changes. If you want the Application Kit to resume automatic width assignments, invoke this method with a negative width value.
NSFormCell.h
Sets the cell title and mnemonic character.
- (void)setTitleWithMnemonic:(NSString *)titleWithAmpersand
The title of the cell, including a mnemonic identifier. To specify the mnemonic character, place an ampersand (&) in the front of the desired character.
Mnemonics are not supported in Mac OS X.
NSFormCell.hReturns the receiver’s title.
- (NSString *)title
The title of the cell. The default value is "Field:".
NSFormCell.h
Returns the alignment of the title.
- (NSTextAlignment)titleAlignment
The alignment can be one of the following values: NSLeftTextAlignment, NSCenterTextAlignment, or NSRightTextAlignment. The default alignment is NSRightTextAlignment.
NSFormCell.hReturns the default writing direction used to render the form cell’s title.
- (NSWritingDirection)titleBaseWritingDirection
One of the following constants: NSWritingDirectionNatural, NSWritingDirectionLeftToRight, or NSWritingDirectionRightToLeft.
NSFormCell.hReturns the font used to draw the receiver’s title.
- (NSFont *)titleFont
The font object used for the title.
NSFormCell.hReturns the width of the title field.
- (CGFloat)titleWidth
The width of the title field, measured in points in the user coordinate space.
If you set the width using setTitleWidth:, this method returns the value you set; otherwise, it returns the width calculated automatically by the Application Kit.
NSFormCell.hReturns the width of the title field constrained to the specified size.
- (CGFloat)titleWidth:(NSSize)aSize
The maximum size of the field when calculated by the Application Kit.
The width of the title field, measured in points in the user coordinate space.
If you set the width using setTitleWidth:, this method returns the value you set; otherwise, the Application Kit calculates the width, constraining the field size to the specified value.
NSFormCell.h
Last updated: 2006-05-23