Table Views

Display data in a single column of customizable rows.


A table view displays a single column of vertically scrolling content, divided into rows and sections. Each row of a table displays a single piece of information related to your app. Sections let you group related rows together. For example, the Contacts app uses a table to display the names of the user's contacts.

Illustration showing three table view examples. The first contains only rows, the second contains rows grouped into sections, and the third contains custom cells.

Table views are a collaboration between many different objects, including:

  • Cells. A cell provides the visual representation for your content. You can use the default cells provided by UIKit or define custom cells to suit the needs of your app.

  • Table view controller. You typically use a UITableViewController object to manage a table view. You can use other view controllers too, but a table view controller is required for some table-related features to work.

  • Your data source object. This object adopts the UITableViewDataSource protocol and provides the data for the table.

  • Your delegate object. This object adopts the UITableViewDelegate protocol and manages user interactions with the table's contents.



class UITableView

A view that presents data using rows arranged in a single column.


Filling a Table with Data

Create and configure cells for your table dynamically using a data source object, or provide them statically from your storyboard.

protocol UITableViewDataSource

The methods adopted by the object you use to manage data and provide cells for a table view.

protocol UITableViewDataSourcePrefetching

A protocol that provides advance warning of the data requirements for a table view, allowing you to start potentially long-running data operations early.

class UILocalizedIndexedCollation

An object that organizes, sorts, and localizes the data for a table view that has a section index.

protocol UIDataSourceTranslating

An advanced interface for managing a data source object.

class UIRefreshControl

A standard control that can initiate the refreshing of a scroll view’s contents.

Asynchronously Loading Images into Table and Collection Views

Store and fetch images asynchronously to make your app more responsive.

Table Management

Estimating the Height of a Table's Scrolling Area

Provide height estimates for your table view’s headers, footers, and rows to ensure that scrolling accurately reflects the size of your content.

class UITableViewController

A view controller that specializes in managing a table view.

protocol UITableViewDelegate

Methods for managing selections, configuring section headers and footers, deleting and reordering cells, and performing other actions in a table view.

class UITableViewFocusUpdateContext

A context object that provides information relevant to a specific focus update from one view to another.

Cells, Headers, and Footers

Configuring the Cells for Your Table

Specify the appearance and content of your table’s rows by defining one or more prototype cells in your storyboard.

Creating Self-Sizing Table View Cells

Create table view cells that support Dynamic Type and use system spacing constraints to adjust the spacing surrounding text labels.

Adding Headers and Footers to Table Sections

Differentiate groups of rows visually by adding header and footer views to your table view’s sections.

class UITableViewCell

The visual representation of a single row in a table view.

class UITableViewHeaderFooterView

A reusable view that you place at the top or bottom of a table section to display additional information for that section.

Row Actions

class UISwipeActionsConfiguration

The set of actions to perform when swiping on rows of a table.

class UIContextualAction

An action to display when the user swipes a table row.

class UITableViewRowAction

A single action to present when the user swipes horizontally in a table row.


Selection Management

Handling Row Selection in a Table View

Detect when a user taps a table view cell so your app can take the next indicated action.

Selecting Multiple Items with a Two-Finger Pan Gesture

Accelerate user selection of multiple items using the multiselect gesture on table and collection views.

Drag and Drop

Supporting Drag and Drop in Table Views

Initiate drags and handle drops from a table view.

protocol UITableViewDragDelegate

The interface for initiating drags from a table view.

protocol UITableViewDropDelegate

The interface for handling drops in a table view.

protocol UITableViewDropCoordinator

An interface for coordinating your custom drop-related actions with the table view.

protocol UITableViewDropItem

The data associated with an item being dropped into the table view.

class UITableViewDropProposal

Your proposed solution for handling a drop in a table view.

Placeholder Cells

protocol UITableViewDropPlaceholderContext

An object for tracking a placeholder cell that you added to your table during a drop operation.

class UITableViewDropPlaceholder

A placeholder cell that supports customizing the drop preview parameters.

class UITableViewPlaceholder

An object that contains information about a placeholder cell being inserted into a table.

See Also

Container Views

Collection Views

Display nested views using a configurable and highly customizable layout.

class UIStackView

A streamlined interface for laying out a collection of views in either a column or a row.

class UIScrollView

A view that allows the scrolling and zooming of its contained views.