iPhone OS Reference Library Apple Developer Connection spyglass button

UITableViewCell Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/UIKit.framework
Availability
Available in iPhone OS 2.0 and later.
Companion guide
Declared in
UITableViewCell.h
Related sample code

Overview

The UITableViewCell class defines the attributes and behavior of the cells that appear in UITableView objects.

A UITableViewCell object (or table cell) includes properties and methods for managing cell selection, highlighted state, editing state and controls, accessory views, reordering controls, cell background, and content indentation. The class additionally includes properties for setting and managing cell content, specifically text and images.

For iPhone OS 3.0, UITableViewCell includes two major improvements:

You have two ways of extending the standard UITableViewCell object beyond the given styles. To create cells with multiple, variously formatted and sized strings and images for content, you can get the cell'€™s content view (through its contentView property) and add subviews to it. You can also subclass UITableViewCell to obtain cell characteristics and behavior specific to your application'€™s needs. See "€œA Closer Look at Table-View Cells" in Table View Programming Guide for iPhone OS for details.

Note: Setting the background color of a cell (via the backgroundColor property declared by UIView) that is in a group-style table view has an effect in iPhone OS 3.0 that is different than previous versions of the operating system. It now affects the area inside the rounded rectangle instead of the area outside of it.

Tasks

Initializing a UITableViewCell Object

Reusing Cells

Managing Text as Cell Content

Managing Images as Cell Content

Accessing Views of the Cell Object

Managing Accessory Views

Managing Cell Selection and Highlighting

Editing the Cell

Adjusting to State Transitions

Managing Content Indentation

Managing Targets and Actions

These properties are deprecated as of iPhone OS 3.0. Instead, use the tableView:commitEditingStyle:forRowAtIndexPath: method of the UITableViewDataSource protocol or the tableView:accessoryButtonTappedForRowWithIndexPath: method of the UITableViewDelegate protocol.

Properties

For more about Objective-C properties, see “Properties” in The Objective-C Programming Language.

accessoryAction

The selector defining the action message to invoke when users tap the accessory view. (Deprecated. Instead use the tableView:commitEditingStyle:forRowAtIndexPath: or tableView:accessoryButtonTappedForRowWithIndexPath: for handling taps on cells.)

@property(nonatomic) SEL accessoryAction
Discussion

If you specify a selector for the accessory action, a message is sent only if the accessory view is a detail disclosure button—that is, the cell's accessoryType property is assigned a value ofUITableViewCellAccessoryDetailDisclosureButton. If the value of this property is NULL, no action message is sent.

The accessory view is a UITableViewCell-defined control, framework control, or custom control on the right side of the cell. It is often used to display a new view related to the selected cell. If the accessory view inherits from UIControl, you may set a target and action through the addTarget:action:forControlEvents: method. See accessoryView for more information.

Availability
See Also
Declared In
UITableViewCell.h

accessoryType

The type of standard accessory view the cell should use (normal state).

@property(nonatomic) UITableViewCellAccessoryType accessoryType
Discussion

The accessory view appears in the the right side of the cell in the table view’s normal (default) state. The standard accessory views include the disclosure chevron; for a description of valid accessoryType constants, see “Cell Accessory Type.” The default is UITableViewCellAccessoryNone. If a custom accessory view is set through the accessoryView property, the value of this property is ignored. If the cell is enabled and the accessory type is UITableViewCellAccessoryDetailDisclosureButton, the accessory view tracks touches and, when tapped, sends the data-source object a tableView:accessoryButtonTappedForRowWithIndexPath: message.

The accessory-type image cross-fades between normal and editing states if it set for both states; use the editingAccessoryType property to set the accessory type for the cell during editing mode. If this property is not set for both states, the cell is animated to slide in or out, as necessary.

Availability
See Also
Related Sample Code
Declared In
UITableViewCell.h

accessoryView

A view that is used, typically as a control, on the right side of the cell (normal state).

@property(nonatomic, retain) UIView *accessoryView
Discussion

If the value of this property is not nil, the UITableViewCell class uses the given view for the accessory view in the table view’s normal (default) state; it ignores the value of the accessoryType property. The provided accessory view can be a framework-provided control or label or a custom view. The accessory view appears in the the right side of the cell.

The accessory view cross-fades between normal and editing states if it set for both states; use the editingAccessoryView property to set the accessory view for the cell during editing mode. If this property is not set for both states, the cell is animated to slide in or out, as necessary.

Availability
See Also
Related Sample Code
Declared In
UITableViewCell.h

backgroundView

The view used as the background of the cell.

@property(nonatomic, retain) UIView *backgroundView
Discussion

The default is nil for cells in plain-style tables (UITableViewStylePlain) and non-nil for grouped-style tables UITableViewStyleGrouped). UITableViewCell adds the background view as a subview behind all other views and uses its current frame location.

Availability
See Also
Related Sample Code
Declared In
UITableViewCell.h

contentView

Returns the content view of of the cell object. (read-only)

@property(nonatomic, readonly, retain) UIView *contentView
Discussion

The content view of a UITableViewCell object is the default superview for content displayed by the cell. If you want to customize cells by simply adding additional views, you should add them to the content view so they will be positioned appropriately as the cell transitions into and out of editing mode.

Availability
See Also
Related Sample Code
Declared In
UITableViewCell.h

detailTextLabel

Returns the secondary label of the table cell if one exists. (read-only)

@property(nonatomic, readonly, retain) UILabel *detailTextLabel
Discussion

Holds the secondary (or detail) label of the cell. UITableViewCell adds an appropriate label when you create the cell in a style that supports secondary labels. If the style doesn’t support detail labels, nil is returned. See “Cell Styles” for descriptions of the main label in currently defined cell styles.

Availability
See Also
Related Sample Code
Declared In
UITableViewCell.h

editAction

The selector defining the action message to invoke when users tap the insert or delete button. (Deprecated. Instead use the tableView:commitEditingStyle:forRowAtIndexPath: or tableView:accessoryButtonTappedForRowWithIndexPath: for handling taps on cells.)

@property(nonatomic) SEL editAction
Discussion

When the cell'€™s table is in editing mode, the cell displays a green insert control or a red delete control to the left of it. (The selectedBackgroundView constant applied to the cell via the editingStyle property determines which control is used.) Typically, the associated UITableView object sets the editing action for all cells; you can use this property to alter the editing action for individual cells. If the value of this property is NULL, no action message is sent.

Availability
See Also
Declared In
UITableViewCell.h

editing

A Boolean value that indicates whether the cell is in an editable state.

@property(nonatomic, getter=isEditing) BOOL editing
Discussion

When a cell is in an editable state, it displays the editing controls specified for it: the green insertion control, the red deletion control, or (on the right side) the reordering control. Use editingStyle and showsReorderControl to specify these controls for the cell.

Availability
Related Sample Code
Declared In
UITableViewCell.h

editingAccessoryType

The type of standard accessory view the cell should use in the table view’s editing state.

@property(nonatomic) UITableViewCellAccessoryType editingAccessoryType
Discussion

The accessory view appears in the the right side of the cell when the table view is in editing mode. The standard accessory views include the disclosure chevron; for a description of valid constants, see “Cell Accessory Type.” The default is UITableViewCellAccessoryNone. If a custom accessory view for editing mode is set through the editingAccessoryView property, the value of this property is ignored. If the cell is enabled and the accessory type is UITableViewCellAccessoryDetailDisclosureButton, the accessory view tracks touches and, when tapped, sends the delegate object a tableView:accessoryButtonTappedForRowWithIndexPath: message.

The accessory type cross-fades between normal and editing states if it set for both states; use the accessoryType property to set the accessory view for the cell during the table view’s normal state. If this property is not set for both states, the cell is animated to slide or out, as necessary.

Availability
See Also
Related Sample Code
Declared In
UITableViewCell.h

editingAccessoryView

A view that is used typically as a control on the right side of the cell when it is in editing mode.

@property(nonatomic, retain) UIView *editingAccessoryView
Discussion

If the value of this property is not nil, the UITableViewCell class uses the given view for the accessory view in the table view’s editing state; it ignores the value of the editingAccessoryType property. The provided accessory view can be a framework-provided control or label or a custom view. The accessory view appears in the the right side of the cell.

The accessory type cross-fades between normal and editing states if it set for both states; use the accessoryType property to set the accessory view for the cell during the table view’s normal state. If this property is not set for both states, the cell is animated to slide or out, as necessary.

Availability
See Also
Declared In
UITableViewCell.h

editingStyle

The editing style of the cell. (read-only)

@property(nonatomic, readonly) UITableViewCellEditingStyle editingStyle
Discussion

One of the constants described in “Cell Editing Style” is used as the value of this property; it specifies whether the cell is in an editable state and, if it is, whether it shows an insertion or deletion control. The default value is UITableViewCellEditingStyleNone (not editable). The delegate returns the value this property for a particular cell in its implementation of the tableView:editingStyleForRowAtIndexPath: method.

Availability
See Also
Declared In
UITableViewCell.h

font

The font of the title. (Deprecated. Instead, set the fonts of the UILabel objects assigned to the textLabel and detailTextLabel properties.)

@property(nonatomic, retain) UIFont *font
Discussion

If the value of this property is nil (the default), UITableViewCell uses a standard font optimized for the device.

Availability
Declared In
UITableViewCell.h

hidesAccessoryWhenEditing

A Boolean value that determines whether the accessory view is hidden when the cell is being edited. (Deprecated. Use the editingAccessoryType and editingAccessoryView properties instead.)

@property(nonatomic) BOOL hidesAccessoryWhenEditing
Discussion

The default value is YES.

Availability
Declared In
UITableViewCell.h

highlighted

A Boolean value that indicates whether the cell is highlighted.

@property(nonatomic, getter=isHighlighted) BOOL highlighted
Discussion

The highlighting affects the appearance of labels, image, and background. When the the highlighted state of a cell is set to YES, labels are drawn in their highlighted text color (default is white). The default value is is NO. If you set the highlighted state to YES through this property, the transition to the new state appearance is not animated. For animated highlighted-state transitions, see the setHighlighted:animated: method.

Note that for highlighting to work properly, you must fetch the cell’s labels using the textLabel and detailTextLabel properties and set each label’s highlightedTextColor property; for images, get the cell’s image using the imageView property and set the UIImageView object’s highlightedImage property.

Availability
Declared In
UITableViewCell.h

image

The image to use as content for the cell. (Deprecated. Instead use the imageView property to get UIImageView object and then get or set the encapsulated image.)

@property(nonatomic, retain) UIImage *image
Discussion

The default value of the property is nil (no image). Images are positioned to the left of the title.

Availability
See Also
Related Sample Code
Declared In
UITableViewCell.h

imageView

Returns the image view of the table cell. (read-only)

@property(nonatomic, readonly, retain) UIImageView *imageView
Discussion

Returns the image view (UIImageView object) of the table view, which initially has no image set. If an image is set, it appears on the left side of the cell, before any label. UITableViewCell creates the image-view object when you create the cell.

Availability
See Also
Related Sample Code
Declared In
UITableViewCell.h

indentationLevel

Adjusts the indentation level of a cell whose content is indented.

@property(nonatomic) NSInteger indentationLevel
Discussion

The default value of the property is zero (no indentation). The width for each level of indentation is determined by the indentationWidth property.

Availability
Declared In
UITableViewCell.h

indentationWidth

The width for each level of indentation of a cell'€™s content.

@property(nonatomic) CGFloat indentationWidth
Discussion

The default indentation width is 10.0 points.

Availability
See Also
Declared In
UITableViewCell.h

lineBreakMode

The mode for for wrapping and truncating text in the cell. (Deprecated. Instead set the line-break mode attribute of the UILabel objects assigned to the textLabel and detailTextLabel properties.)

@property(nonatomic) UILineBreakMode lineBreakMode
Discussion

For further information, see the UILineBreakMode constants described in NSString UIKit Additions Reference. The default value is UILineBreakModeTailTruncation.

Availability
Declared In
UITableViewCell.h

reuseIdentifier

A string used to identify a cell that is reusable. (read-only)

@property(nonatomic, readonly, copy) NSString *reuseIdentifier
Discussion

The reuse identifier is associated with a UITableViewCell object that the table-view’s delegate creates with the intent to reuse it as the basis (for performance reasons) for multiple rows of a table view. It is assigned to the cell object in initWithFrame:reuseIdentifier: and cannot be changed thereafter. A UITableView object maintains a queue (or list) of the currently reusable cells, each with its own reuse identifier, and makes them available to the delegate in the dequeueReusableCellWithIdentifier: method.

Availability
See Also
Declared In
UITableViewCell.h

selected

A Boolean value that indicates whether the cell is selected.

@property(nonatomic, getter=isSelected) BOOL selected
Discussion

The selection affects the appearance of labels, image, and background. When the the selected state of a cell is set to YES, it draws the background for selected cells with its title in white. The default value is is NO. If you set the selection state to YES through this property, the transition to the new state appearance is not animated. For animated selected-state transitions, see the setSelected:animated: method.

Availability
See Also
Declared In
UITableViewCell.h

selectedBackgroundView

The view used as the background of the cell when it is selected.

@property(nonatomic, retain) UIView *selectedBackgroundView
Discussion

The default is nil for cells in plain-style tables (UITableViewStylePlain) and non-nil for section-group tables UITableViewStyleGrouped). UITableViewCell adds the value of this property as a subview only when the cell is selected. It adds the selected background view as a subview directly above the background view (backgroundView) if it is not nil, or behind all other views. Calling setSelected:animated: causes the selected background view to animate in and out with an alpha fade.

Availability
See Also
Declared In
UITableViewCell.h

selectedImage

The image to use a cell content when the cell is selected. (Deprecated. Instead use the imageView property to obtain the UIImageView object and then get or set its highlightedImage property.)

@property(nonatomic, retain) UIImage *selectedImage
Discussion

The default value of this property is nil (no image).

Availability
See Also
Declared In
UITableViewCell.h

selectedTextColor

The color of the title text when the cell is selected. (Deprecated. Instead set the selected text color attribute of the UILabel objects assigned to the textLabel and detailTextLabel properties.)

@property(nonatomic, retain) UIColor *selectedTextColor
Discussion

If the value of property is nil (the default), the color of text in a selected cell is white.

Availability
Declared In
UITableViewCell.h

selectionStyle

The style of selection for a cell.

@property(nonatomic) UITableViewCellSelectionStyle selectionStyle
Discussion

The selection style is a backgroundView constant that determines the color of a cell when it is selected. The default value is UITableViewCellSelectionStyleBlue. See “Cell Selection Style” for a description of valid constants.

Availability
See Also
Related Sample Code
Declared In
UITableViewCell.h

shouldIndentWhileEditing

A Boolean value that controls whether the cell background is indented when the table view is in editing mode.

@property(nonatomic) BOOL shouldIndentWhileEditing
Discussion

The default value is YES. This property is unrelated to indentationLevel. The delegate can override this value in tableView:shouldIndentWhileEditingRowAtIndexPath:. This property has an effect only on table views created in the grouped style (UITableViewStyleGrouped); it has no effect on UITableViewStylePlain table views.

Availability
Declared In
UITableViewCell.h

showingDeleteConfirmation

Returns whether the cell is currently showing the delete-confirmation button. (read-only)

@property(nonatomic, readonly) BOOL showingDeleteConfirmation
Discussion

When users tap the deletion control (the red circle to the left of the cell), the cell displays a "Delete" button on the right side of the cell; this string is localized.

Availability
Declared In
UITableViewCell.h

showsReorderControl

A Boolean value that determines whether the cell shows the reordering control.

@property(nonatomic) BOOL showsReorderControl
Discussion

The reordering control is gray, multiple horizontal bar control on the right side of the cell. Users can drag this control to reorder the cell within the table. The default value is NO. If the value is YES , the reordering control temporarily replaces any accessory view.

For the reordering control to appear, you must not only set this property but implement the UITableViewDataSource method tableView:moveRowAtIndexPath:toIndexPath:. In addition, if the data source implements tableView:canMoveRowAtIndexPath: to return NO, the reordering control does not appear in that designated row.

Availability
Declared In
UITableViewCell.h

target

The target object to receive action messages. (Deprecated. Instead use the tableView:commitEditingStyle:forRowAtIndexPath: or tableView:accessoryButtonTappedForRowWithIndexPath: for handling taps on cells.)

@property(nonatomic, assign) id target
Discussion

The target object receives action messages when the user taps a cell'€™s insert button, delete button, or accessory view. The default value is nil, which tells the application to go up the responder chain to find a target. Note that the target is a weak reference.

Availability
See Also
Declared In
UITableViewCell.h

text

The text of the cell. (Deprecated. Use the textLabel and detailTextLabel properties instead.)

@property(nonatomic, copy) NSString *text
Discussion

The default is nil (no text).

Availability
Related Sample Code
Declared In
UITableViewCell.h

textAlignment

A constant that specifies the alignment of text in the cell. (Deprecated. Instead set the text alignment of the UILabel objects assigned to the textLabel and detailTextLabel properties.)

@property(nonatomic) UITextAlignment textAlignment
Discussion

If the value of the property is nil (the default), the title is left-aligned (UITextAlignmentLeft). See the descriptions of the UITextAlignment constants for alternative text alignments.

Availability
Declared In
UITableViewCell.h

textColor

The color of the title text. (Deprecated. Instead set the text color attribute of the UILabel objects assigned to the textLabel and detailTextLabel properties.)

@property(nonatomic, retain) UIColor *textColor
Discussion

If the value of property is nil (the default), the color of text is black.

Availability
Declared In
UITableViewCell.h

textLabel

Returns the label used for the main textual content of the table cell. (read-only)

@property(nonatomic, readonly, retain) UILabel *textLabel
Discussion

Holds the main label of the cell. UITableViewCell adds an appropriate label when you create the cell in a given cell style. See “Cell Styles” for descriptions of the main label in currently defined cell styles.

Availability
See Also
Related Sample Code
Declared In
UITableViewCell.h

Instance Methods

didTransitionToState:

Called on the cell just after it transitions between cell states.

- (void)didTransitionToState:(UITableViewCellStateMask)state

Parameters
state

A bit mask indicating the state or combination of states the cell is transitioning to.

Discussion

Subclasses of UITableViewCell can implement this method to animate additional changes to a cell when it is changing state. UITableViewCell calls this method whenever a cell transitions between states, such as from a normal state (the default) to editing mode. This method is called at the end of the animation block, which gives the custom cell a chance to clean up after the state change—for example, removing the edit and reorder controls after transitioning out of editing. Subclasses must always call super when overriding this method.

Note that when the user swipes a cell to delete it, the cell transitions to the state identified by the UITableViewCellStateShowingDeleteConfirmationMask constant but the UITableViewCellStateEditingMask is not set.

Availability
  • Available in iPhone OS 3.0 and later.
See Also
Declared In
UITableViewCell.h

initWithStyle:reuseIdentifier:

Initializes a table cell with a style and a reuse identifier and returns it to the caller.

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier

Parameters
style

A constant indicating a cell style. See “Cell Styles” for descriptions of these constants.

reuseIdentifier

A string used to identify the cell object if it is to be reused for drawing multiple rows of a table view. Pass nil if the cell object is not to be reused. You should use the same reuse identifier for all cells of the same form.

Return Value

An initialized UITableViewCell object or nil if the object could not be created.

Discussion

This method is the designated initializer for the class. The reuse identifier is associated with those cells (rows) of a table view that have the same general configuration, minus cell content. In its implementation of tableView:cellForRowAtIndexPath:, the table view'€™s delegate calls the UITableView method dequeueReusableCellWithIdentifier:, passing in a reuse identifier, to obtain the cell object to use as the basis for the current row.

If you want a table cell that has a configuration different that those defined by UITableViewCell for style, you must create your own custom cell. If you want to set the row height of cells on an individual basis, implement the delegate method tableView:heightForRowAtIndexPath:.

Availability
  • Available in iPhone OS 3.0 and later.
Related Sample Code
Declared In
UITableViewCell.h

prepareForReuse

Prepares a reusable cell for reuse by the table view'€™s delegate.

- (void)prepareForReuse

Discussion

If a UITableViewCell object is reusable—that is, it has a reuse identifier—this method is invoked just before the object is returned from the UITableView method dequeueReusableCellWithIdentifier:. For performance reasons, you should only reset attributes of the cell that are not related to content, for example, alpha, editing, and selection state. The table view'€™s delegate in tableView:cellForRowAtIndexPath: should always reset all content when reusing a cell. If the cell object does not have an associated reuse identifier, this method is not called. If you override this method, you must be sure to invoke the superclass implementation.

Availability
  • Available in iPhone OS 2.0 and later.
See Also
Declared In
UITableViewCell.h

setEditing:animated:

Toggles the receiver into and out of editing mode.

- (void)setEditing:(BOOL)editing animated:(BOOL)animated

Parameters
editing

YES to enter editing mode, NO to leave it. The default value is NO .

animated

YES to animate the appearance or disappearance of the insertion/deletion control and the reordering control, NO to make the transition immediate.

Discussion

When you call this method with the value of editing set to YES, and the UITableViewCell object is configured to have controls, the cell shows an insertion (green plus) or deletion control (red minus) on the left side of each cell and a reordering control on the right side. This method is called on each visible cell when the setEditing:animated: method of UITableView is invoked. Calling this method with editing set to NO removes the controls from the cell.

Availability
  • Available in iPhone OS 2.0 and later.
See Also
Declared In
UITableViewCell.h

setHighlighted:animated:

Sets the highlighted state of the cell, optionally animating the transition between states.

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated

Parameters
highlighted

YES to set the cell as highlighted, NO to set it as unhighlighted. The default is NO.

animated

YES to animate the transition between highlighted states, NO to make the transition immediate.

Discussion

Highlights or un-highlights the cell, animating the transition between regular and highlighted state if animated is YES. Highlighting affects the appearance of the cell’s labels, image, and background.

Note that for highlighting to work properly, you must fetch the cell’s label (or labels) using the textLabel (and detailTextLabel properties and set the label’s highlightedTextColor property; for images, get the cell’s image using the imageView property and set the UIImageView object’s highlightedImage property.

A custom table cell may override this method to make any transitory appearance changes.

Availability
  • Available in iPhone OS 3.0 and later.
Declared In
UITableViewCell.h

setSelected:animated:

Sets the selected state of the cell, optionally animating the transition between states.

- (void)setSelected:(BOOL)selected animated:(BOOL)animated

Parameters
selected

YES to set the cell as selected, NO to set it as unselected. The default is NO.

animated

YES to animate the transition between selected states, NO to make the transition immediate.

Discussion

The selection affects the appearance of labels, image, and background. When the the selected state of a cell to YES, it draws the background for selected cells (“Reusing Cells”) with its title in white.

Availability
  • Available in iPhone OS 2.0 and later.
See Also
Declared In
UITableViewCell.h

willTransitionToState:

Called on the cell just before it transitions between cell states.

- (void)willTransitionToState:(UITableViewCellStateMask)state

Parameters
state

A bit mask indicating the state or combination of states the cell is transitioning to.

Discussion

Subclasses of UITableViewCell can implement this method to animate additional changes to a cell when it is changing state. UITableViewCell calls this method whenever a cell transitions between states, such as from a normal state (the default) to editing mode. The custom cell can set up and position any new views that appear with the new state. The cell then receives a layoutSubviews message (UIView) in which it can position these new views in their final locations for the new state. Subclasses must always call super when overriding this method.

Note that when the user swipes a cell to delete it, the cell transitions to the state identified by the UITableViewCellStateShowingDeleteConfirmationMask constant but the UITableViewCellStateEditingMask is not set.

Availability
  • Available in iPhone OS 3.0 and later.
See Also
Declared In
UITableViewCell.h

Constants

Cell Styles

An enumeration for the various styles of cells.

typedef enum {
   UITableViewCellStyleDefault,
   UITableViewCellStyleValue1,
   UITableViewCellStyleValue2,
   UITableViewCellStyleSubtitle
} UITableViewCellStyle;
Constants
UITableViewCellStyleDefault

A simple style for a cell with a text label (black and left-aligned) and an optional image view. Note that this is the default style for cells prior to iPhone OS 3.0.

Available in iPhone OS 3.0 and later.

Declared in UITableViewCell.h.

UITableViewCellStyleValue1

A style for a cell with a label on the left side of the cell with left-aligned and black text; on the right side is a label that has smaller blue text and is right-aligned. The Settings application uses cells in this style.

Available in iPhone OS 3.0 and later.

Declared in UITableViewCell.h.

UITableViewCellStyleValue2

A style for a cell with a label on the left side of the cell with text that is right-aligned and blue; on the right side of the cell is another label with smaller text that is left-aligned and black. The Phone/Contacts application uses cells in this style.

Available in iPhone OS 3.0 and later.

Declared in UITableViewCell.h.

UITableViewCellStyleSubtitle

A style for a cell with a left-aligned label across the top and a left-aligned label below it in smaller gray text. The iPod application uses cells in this style.

Available in iPhone OS 3.0 and later.

Declared in UITableViewCell.h.

Discussion

In all these cell styles, the larger of the text labels is accessed via the textLabel property and the smaller via the detailTextLabel property.

UITableViewCellStateMask

The type of the constants used as cell-state masks.

typedef NSUInteger UITableViewCellStateMask;
Discussion

See “Cell State Mask Constants” for descriptions of the constants.

Availability
  • Available in iPhone OS 3.0 and later.
Declared In
UITableViewCell.h

Cell State Mask Constants

Constants used to determine the new state of a cell as it transitions between states.

enum {
   UITableViewCellStateDefaultMask                     = 0,
   UITableViewCellStateEditingMask                     = 1 << 0,
   UITableViewCellStateShowingDeleteConfirmationMask   = 1 << 1
};
Constants
UITableViewCellStateDefaultMask

The normal state of a table cell.

UITableViewCellStateEditingMask

The state of a table view cell when the table view is in editing mode.

UITableViewCellStateShowingDeleteConfirmationMask

The state of a table view cell that shows a button requesting confirmation of a delete gesture.

Discussion

The methods that use these constants are didTransitionToState: and willTransitionToState:.

Cell Selection Style

The style of selected cells.

typedef enum {
   UITableViewCellSelectionStyleNone,
   UITableViewCellSelectionStyleBlue,
   UITableViewCellSelectionStyleGray
} UITableViewCellSelectionStyle;
Constants
UITableViewCellSelectionStyleNone

The cell has no distinct style for when it is selected.

Available in iPhone OS 2.0 and later.

Declared in UITableViewCell.h.

UITableViewCellSelectionStyleBlue

The cell when selected has a blue background. This is the default value.

Available in iPhone OS 2.0 and later.

Declared in UITableViewCell.h.

UITableViewCellSelectionStyleGray

Then cell when selected has a gray background.

Available in iPhone OS 2.0 and later.

Declared in UITableViewCell.h.

Discussion

You use these constants to to set the value of the selectionStyle property.

Declared In
UITableViewCell.h

Cell Editing Style

The editing control used by a cell.

typedef enum {
   UITableViewCellEditingStyleNone,
   UITableViewCellEditingStyleDelete,
   UITableViewCellEditingStyleInsert
} UITableViewCellEditingStyle;
Constants
UITableViewCellEditingStyleNone

The cell has no editing control. This is the default value.

Available in iPhone OS 2.0 and later.

Declared in UITableViewCell.h.

UITableViewCellEditingStyleDelete

The cell has the delete editing control; this control is a red circle enclosing a minus sign.

Available in iPhone OS 2.0 and later.

Declared in UITableViewCell.h.

UITableViewCellEditingStyleInsert

The cell has the insert editing control; this control is a green circle enclosing a plus sign.

Available in iPhone OS 2.0 and later.

Declared in UITableViewCell.h.

Discussion

You use them to to set the value of the editingStyle property.

Declared In
UITableViewCell.h

Cell Accessory Type

The type of standard accessory control used by a cell.

typedef enum {
   UITableViewCellAccessoryNone,
   UITableViewCellAccessoryDisclosureIndicator,
   UITableViewCellAccessoryDetailDisclosureButton,
   UITableViewCellAccessoryCheckmark
} UITableViewCellAccessoryType;
Constants
UITableViewCellAccessoryNone

The cell does not have any accessory view. This is the default value.

Available in iPhone OS 2.0 and later.

Declared in UITableViewCell.h.

UITableViewCellAccessoryDisclosureIndicator

The cell has an accessory control shaped like a regular chevron. It is intended as a disclosure indicator. The control doesn't track touches.

Available in iPhone OS 2.0 and later.

Declared in UITableViewCell.h.

UITableViewCellAccessoryDetailDisclosureButton

The cell has an accessory control that is a blue button with a chevron image as content. It is intended for configuration purposes. The control tracks touches.

Available in iPhone OS 2.0 and later.

Declared in UITableViewCell.h.

UITableViewCellAccessoryCheckmark

The cell has a check mark on its right side. This control doesn'€™t track touches. The delegate of the table view can manage check marks in a section of rows (possibly limiting the check mark to one row of the section) in its tableView:didSelectRowAtIndexPath: method.

Available in iPhone OS 2.0 and later.

Declared in UITableViewCell.h.

Discussion

You use these constants when setting the value of the accessoryType property.

Declared In
UITableViewCell.h

Cell Separator Style

The style for cells used as separators.

typedef enum {
   UITableViewCellSeparatorStyleNone,
   UITableViewCellSeparatorStyleSingleLine
} UITableViewCellSeparatorStyle;
Constants
UITableViewCellSeparatorStyleNone

The separator cell has no distinct style.

Available in iPhone OS 2.0 and later.

Declared in UITableViewCell.h.

UITableViewCellSeparatorStyleSingleLine

The separator cell has a single line running across its width. This is the default value

Available in iPhone OS 2.0 and later.

Declared in UITableViewCell.h.

Discussion

You use these constants to to set the value of the separatorStyle property defined by UITableView.

Declared In
UITableViewCell.h


Last updated: 2009-07-30

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