Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/AppKit.framework |
Availability | Available in Mac OS X v10.0 and later. |
Companion guide | |
Declared in | NSTableColumn.h |
Related sample code |
An NSTableColumn stores the display characteristics and attribute identifier for a column in an NSTableView. The NSTableColumn determines the width and width limits, resizability, and editability of its column in the NSTableView. It also stores two NSCell objects: the header cell, which is used to draw the column header, and the data cell, used to draw the values for each row. You can control the display of the column by setting the subclasses of NSCell used and by setting the font and other display characteristics for these NSCells. For example, you can use the default NSTextFieldCell for displaying string values or substitute an NSImageCell to display pictures.
– setWidth:
– width
– setMinWidth:
– minWidth
– setMaxWidth:
– maxWidth
– setResizingMask:
– resizingMask
– sizeToFit
Returns the NSCell object used by the NSTableView to draw values for the receiver.
- (id)dataCell
NSTableColumn.h
Returns the NSCell object used by the NSTableView to draw values for the receiver.
- (id)dataCellForRow:(NSInteger)row
NSTableView always calls this method. By default, this method just calls dataCell
. Subclassers can override if they need to potentially use different cells for different rows. Subclasses should expect this method to be invoked with row equal to –1 in cases where no actual row is involved but the table view needs to get some generic cell info.
NSTableColumn.h
Returns the NSTableHeaderCell object used to draw the header of the receiver.
- (id)headerCell
You can set the column title by sending setStringValue:
to this object.
NSTableColumn.h
Returns the tooltip string that is displayed when the cursor pauses over the header cell of the receiver.
- (NSString *)headerToolTip
The tooltip displayed when the cursor pauses over the header cell of the receiver.
NSTableColumn.h
Returns the object used by the data source to identify the attribute corresponding to the receiver.
- (id)identifier
NSTableColumn.h
Initializes a newly created NSTableColumn with identifier as its identifier and with an NSTextFieldCell as its data cell.
- (id)initWithIdentifier:(id)identifier
Send setStringValue:
to the header cell to set the column title. This method is the designated initializer for the NSTableColumn class. Returns an initialized object.
See the NSTableView class specification for information on identifiers.
NSTableColumn.h
Returns YES
if the user can edit cells associated with the receiver by double-clicking the column in the NSTableView, NO
otherwise.
- (BOOL)isEditable
You can initiate editing programmatically regardless of this setting with NSTableView’s editColumn:row:withEvent:select:
method.
NSTableColumn.h
Returns a Boolean value that indicates whether the receiver is hidden.
- (BOOL)isHidden
YES if the receiver is hidden, otherwise NO.
NSTableColumn.h
Returns YES
if the user is allowed to resize the receiver in its NSTableView, NO
otherwise.
- (BOOL)isResizable
You can change the size programmatically regardless of this setting.
This method is deprecated. You should use resizingMask
instead.
NSTableColumn.h
Returns the maximum width of the receiver.
- (CGFloat)maxWidth
The receiver’s width can’t be made larger than this size either by the user or programmatically.
– minWidth
– width
– setMaxWidth:
– autoresizesAllColumnsToFit
(NSTableView)NSTableColumn.h
Returns the minimum width for the receiver.
- (CGFloat)minWidth
The receiver’s width can’t be made less than this size either by the user or programmatically.
– maxWidth
– width
– setMinWidth:
– autoresizesAllColumnsToFit
(NSTableView)NSTableColumn.h
Returns the receiver’s resizing mask.
- (NSUInteger)resizingMask
See “Resizing Modes”
for a description of the resizing mask constants.
NSTableColumn.h
Sets the NSCell used by the NSTableView to draw individual values for the receiver to aCell.
- (void)setDataCell:(NSCell *)aCell
You can use this method to control the font, alignment, and other text attributes for an NSTableColumn. You can also assign a cell to display things other than text—for example, an NSImageCell to display images.
NSTableColumn.h
Controls whether the user can edit cells in the receiver by double-clicking them.
- (void)setEditable:(BOOL)flag
If flag is YES
a double click initiates editing; if flag is NO
it merely sends the double-click action to the NSTableView’s target. You can initiate editing programmatically regardless of this setting with NSTableView’s editColumn:row:withEvent:select:
method.
NSTableColumn.h
Sets the NSCell used to draw the receiver’s header to aCell.
- (void)setHeaderCell:(NSCell *)aCell
aCell should never be nil
.
NSTableColumn.h
Sets the tooltip string that is displayed when the cursor pauses over the header cell of the receiver.
- (void)setHeaderToolTip:(NSString *)string
A string that functions as the tooltip for the header cell of the receiver.
NSTableColumn.h
Sets whether the receiver is hidden.
- (void)setHidden:(BOOL)hidden
YES if the receiver is to be hidden, otherwise NO.
Columns which are hidden still exist in the tableview’s tableColumns
array and are included in the tableview’s numberOfColumns
count.
The hidden state of the receiver is stored when the tableview autosaves the NSTableColumn state.
NSTableColumn.h
Sets the receiver’s identifier to anObject.
- (void)setIdentifier:(id)anObject
This object is used by the data source to identify the attribute corresponding to the NSTableColumn.
NSTableColumn.h
Sets the receiver’s maximum width to maxWidth, also adjusting the current width if it’s greater than this value.
- (void)setMaxWidth:(CGFloat)maxWidth
The NSTableView can be made no wider than this size, either by the user or programmatically.
– setMinWidth:
– setWidth:
– maxWidth
– autoresizesAllColumnsToFit
(NSTableView)NSTableColumn.h
Sets the receiver’s minimum width to minWidth, also adjusting the current width if it’s less than this value.
- (void)setMinWidth:(CGFloat)minWidth
The NSTableView can be made no less wide than this size, either by the user or programmatically.
– setMaxWidth:
– setWidth:
– minWidth
– autoresizesAllColumnsToFit
(NSTableView)NSTableColumn.h
Sets whether the user can resize the receiver in its NSTableView.
- (void)setResizable:(BOOL)flag
If flag is YES
the user can resize the receiver; if flag is NO
the user can’t resize it. You can always set the size programmatically.
This method is deprecated. You should use setResizingMask:
instead.
NSTableColumn.h
Sets the resizing mask for the receiver to resizingMask.
- (void)setResizingMask:(NSUInteger)resizingMask
If resizingMask is 0
, the column is not resizable. See “Resizing Modes”
for the appropriate mask values.
NSTableColumn.h
Sets the receiver’s sort descriptor prototype.
- (void)setSortDescriptorPrototype:(NSSortDescriptor *)sortDescriptor
A table column is considered sortable if it has a sort descriptor that specifies the sorting direction, a key to sort by, and a selector defining how to sort.
NSTableColumn.h
Sets aTableView as the receiver’s NSTableView.
- (void)setTableView:(NSTableView *)aTableView
You should never need to invoke this method; it’s invoked automatically when you add an NSTableColumn to an NSTableView.
– tableView
– addTableColumn:
(NSTableView)NSTableColumn.h
Sets the receiver’s width to newWidth.
- (void)setWidth:(CGFloat)newWidth
If newWidth exceeds the minimum or maximum width, it’s adjusted to the appropriate limiting value. Marks the NSTableView as needing display.
This method posts NSTableViewColumnDidResizeNotification
on behalf of the receiver’s NSTableView.
– width
– setMinWidth:
– setMaxWidth:
– autoresizesAllColumnsToFit
(NSTableView)NSTableColumn.h
Resizes the receiver to fit the width of its header cell.
- (void)sizeToFit
If the maximum width is less than the width of the header, the maximum is increased to the header’s width. Similarly, if the minimum width is greater than the width of the header, the minimum is reduced to the header’s width. Marks the NSTableView as needing display if the width actually changes.
– width
– minWidth
– maxWidth
– autoresizesAllColumnsToFit
(NSTableView)NSTableColumn.h
Returns the receiver’s sort descriptor prototype.
- (NSSortDescriptor *)sortDescriptorPrototype
NSTableColumn.h
Returns the NSTableView the receiver belongs to.
- (NSTableView *)tableView
NSTableColumn.h
Returns the width of the receiver.
- (CGFloat)width
NSTableColumn.h
These constants specify the resizing modes available for the table column. You specify either NSTableColumnNoResizing or a resizing mask created using the C bitwise OR operator. These values are then passed as the parameter to the setResizingMask:
method.
enum { NSTableColumnNoResizing = 0, NSTableColumnAutoresizingMask = ( 1 << 0 ), NSTableColumnUserResizingMask = ( 1 << 1 ), };
NSTableColumnNoResizing
Prevents the table column from resizing.
Available in Mac OS X v10.4 and later.
Declared in NSTableColumn.h
.
NSTableColumnAutoresizingMask
Allows the table column to resize automatically in response to resizing the tableview. Enabling this option is the same as enabling the "Live Resizable" option in Interface Builder. The resizing behavior for the table view is set using the NSTableView
method setColumnAutoresizingStyle:
.
Available in Mac OS X v10.4 and later.
Declared in NSTableColumn.h
.
NSTableColumnUserResizingMask
Allows the table column to be resized explicitly by the user. Enabling this option is the same as enabling the "User Resizable" option in Interface Builder.
Available in Mac OS X v10.4 and later.
Declared in NSTableColumn.h
.
NSTableColumn.h
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-10-31)