<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITableView",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UITableView"
  },
  "title" : "UITableView"
}
-->

# UITableView

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

```
@MainActor class UITableView
```

## Overview

Table views in iOS display rows of vertically scrolling content in a single column. Each row in the table contains one piece of your app’s content. You can configure a table to display a single long list of rows, or you can group related rows into sections to make navigating the content easier.

When you organize rows into sections in a table, you can choose to present sections in a plain or grouped visual [`UITableView.Style`](/documentation/UIKit/UITableView/Style-swift.enum). For example, the Contacts app displays the name of each contact in a separate row, organized into sections by the first letter of each contact’s last name. It presents the sections with a plain style. The main page of the Settings app displays the available settings organized into related sections, and presents those sections in a grouped visual style.



![A screenshot of the Contacts app, which uses a table to organize the user's individual contacts in a scrolling list.](images/com.apple.uikit/uitableview-1@2x.png)



![A screenshot of the Settings app, which displays different groups of settings in a scrolling list.](images/com.apple.uikit/uitableview-2@2x.png)

Tables are common in apps with data that’s highly structured or organized hierarchically. Apps that contain hierarchical data often use tables in conjunction with a navigation view controller, which facilitates navigation between different levels of the hierarchy. For example, the Settings app uses tables and a navigation controller to organize the system settings.

[`UITableView`](/documentation/UIKit/UITableView) manages the basic appearance of the table, but your app provides the cells ([`UITableViewCell`](/documentation/UIKit/UITableViewCell) objects) that display the actual content. The standard cell configurations display a simple combination of text and images, but you can define custom cells that display any content you want. You can also supply header and footer views to provide additional information for groups of cells.

### Add a table view to your interface

To add a table view to your interface, drag a table view controller ([`UITableViewController`](/documentation/UIKit/UITableViewController)) object to your storyboard. Xcode creates a new scene that includes both the view controller and a table view, ready for you to configure and use.

Table views are data-driven, normally getting their data from a data source object that you provide. The data source object manages your app’s data and is responsible for creating and configuring the table’s cells. If the content of your table never changes, you can configure that content in your storyboard file instead.

For information about how to specify your table’s data, see [Filling a table with data](/documentation/UIKit/filling-a-table-with-data).

### Save and restore the table’s current state

Table views support UIKit app restoration. To save and restore the table’s data, assign a nonempty value to the table view’s [`restorationIdentifier`](/documentation/UIKit/UIViewController/restorationIdentifier) property. When you save its parent view controller, the table view automatically saves the index paths for the currently selected and visible rows. If the table’s data source object adopts the [`UIDataSourceModelAssociation`](/documentation/UIKit/UIDataSourceModelAssociation) protocol, the table stores the unique IDs that you provide for those items instead of their index paths.

For information about how to save and restore your app’s state information, see [Preserving your app’s UI across launches](/documentation/UIKit/preserving-your-app-s-ui-across-launches).

## Topics

### Creating a table view

[`init(frame:style:)`](/documentation/UIKit/UITableView/init(frame:style:))

Creates and returns a table view with the specified frame and style.

[`init(coder:)`](/documentation/UIKit/UITableView/init(coder:))

Creates a table view object from data in an unarchiver.

### Providing the data and cells

[`dataSource`](/documentation/UIKit/UITableView/dataSource)

The object that acts as the data source of the table view.

[`prefetchDataSource`](/documentation/UIKit/UITableView/prefetchDataSource)

The object that acts as the prefetching data source for the table view, receiving notifications of upcoming cell data requirements.

[`isPrefetchingEnabled`](/documentation/UIKit/UITableView/isPrefetchingEnabled)

A Boolean value that indicates whether to allow cell and data prefetching.

[`UITableViewDataSource`](/documentation/UIKit/UITableViewDataSource)

The methods that an object adopts to manage data and provide cells for a table view.

[`UITableViewDataSourcePrefetching`](/documentation/UIKit/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.

### Recycling table view cells

[`register(_:forCellReuseIdentifier:)`](/documentation/UIKit/UITableView/register(_:forCellReuseIdentifier:)-5q6bo)

Registers a nib object that contains a cell with the table view under a specified identifier.

[`register(_:forCellReuseIdentifier:)`](/documentation/UIKit/UITableView/register(_:forCellReuseIdentifier:)-3l3ct)

Registers a class to use in creating new table cells.

[`dequeueReusableCell(withIdentifier:for:)`](/documentation/UIKit/UITableView/dequeueReusableCell(withIdentifier:for:))

Returns a reusable table-view cell object for the specified reuse identifier and adds it to the table.

[`dequeueReusableCell(withIdentifier:)`](/documentation/UIKit/UITableView/dequeueReusableCell(withIdentifier:))

Returns a reusable table-view cell object after locating it by its identifier.

### Recycling section headers and footers

[`register(_:forHeaderFooterViewReuseIdentifier:)`](/documentation/UIKit/UITableView/register(_:forHeaderFooterViewReuseIdentifier:)-1rgvc)

Registers a nib object that contains a header or footer with the table view under a specified identifier.

[`register(_:forHeaderFooterViewReuseIdentifier:)`](/documentation/UIKit/UITableView/register(_:forHeaderFooterViewReuseIdentifier:)-20ybb)

Registers a class to use in creating new table header or footer views.

[`dequeueReusableHeaderFooterView(withIdentifier:)`](/documentation/UIKit/UITableView/dequeueReusableHeaderFooterView(withIdentifier:))

Returns a reusable header or footer view after locating it by its identifier.

### Managing interactions with the table

[`delegate`](/documentation/UIKit/UITableView/delegate)

The object that acts as the delegate of the table view.

[`UITableViewDelegate`](/documentation/UIKit/UITableViewDelegate)

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

### Configuring the table’s appearance

[`style`](/documentation/UIKit/UITableView/style-swift.property)

The style of the table view.

[`UITableView.Style`](/documentation/UIKit/UITableView/Style-swift.enum)

Constants for the table view styles.

[`tableHeaderView`](/documentation/UIKit/UITableView/tableHeaderView)

The view that displays above the table’s content.

[`tableFooterView`](/documentation/UIKit/UITableView/tableFooterView)

The view that displays below the table’s content.

[`backgroundView`](/documentation/UIKit/UITableView/backgroundView)

The background view of the table view.

### Configuring cell height and layout

[`rowHeight`](/documentation/UIKit/UITableView/rowHeight)

The default height in points of each row in the table view.

[`estimatedRowHeight`](/documentation/UIKit/UITableView/estimatedRowHeight)

The estimated height of rows in the table view.

[`fillerRowHeight`](/documentation/UIKit/UITableView/fillerRowHeight)

The height for empty rows that fill the table view.

[`cellLayoutMarginsFollowReadableWidth`](/documentation/UIKit/UITableView/cellLayoutMarginsFollowReadableWidth)

A Boolean value that indicates whether the cell margins derive from the width of the readable content guide.

[`insetsContentViewsToSafeArea`](/documentation/UIKit/UITableView/insetsContentViewsToSafeArea)

A Boolean value that indicates whether the table view adjusts the content views of its cells, headers, and footers to fit within the safe area.

### Configuring header and footer appearance

[`sectionHeaderHeight`](/documentation/UIKit/UITableView/sectionHeaderHeight)

The height of section headers in the table view.

[`sectionFooterHeight`](/documentation/UIKit/UITableView/sectionFooterHeight)

The height of section footers in the table view.

[`estimatedSectionHeaderHeight`](/documentation/UIKit/UITableView/estimatedSectionHeaderHeight)

The estimated height of section headers in the table view.

[`estimatedSectionFooterHeight`](/documentation/UIKit/UITableView/estimatedSectionFooterHeight)

The estimated height of section footers in the table view.

[`sectionHeaderTopPadding`](/documentation/UIKit/UITableView/sectionHeaderTopPadding)

The amount of padding above each section header.

### Customizing the separator appearance

[`separatorStyle`](/documentation/UIKit/UITableView/separatorStyle)

The style for table cells to use as separators.

[`UITableViewCell.SeparatorStyle`](/documentation/UIKit/UITableViewCell/SeparatorStyle)

The style for cells to use as separators.

[`separatorColor`](/documentation/UIKit/UITableView/separatorColor)

The color of separator rows in the table view.

[`separatorEffect`](/documentation/UIKit/UITableView/separatorEffect)

The effect to apply to table separators.

[`separatorInset`](/documentation/UIKit/UITableView/separatorInset)

The default inset of cell separators.

[`separatorInsetReference`](/documentation/UIKit/UITableView/separatorInsetReference-swift.property)

An indicator of how to interpret the separator inset value.

[`UITableView.SeparatorInsetReference`](/documentation/UIKit/UITableView/SeparatorInsetReference-swift.enum)

Constants that indicate how to interpret the separator inset value of a table view.

### Getting the number of rows and sections

[`numberOfRows(inSection:)`](/documentation/UIKit/UITableView/numberOfRows(inSection:))

Returns the number of rows (table cells) in a specified section.

[`numberOfSections`](/documentation/UIKit/UITableView/numberOfSections)

The number of sections in the table view.

### Getting cells and section-based views

[`cellForRow(at:)`](/documentation/UIKit/UITableView/cellForRow(at:))

Returns the table cell at the index path you specify.

[`headerView(forSection:)`](/documentation/UIKit/UITableView/headerView(forSection:))

Returns the header view for the specified section.

[`footerView(forSection:)`](/documentation/UIKit/UITableView/footerView(forSection:))

Returns the footer view for the specified section.

[`indexPath(for:)`](/documentation/UIKit/UITableView/indexPath(for:))

Returns an index path that represents the row and section of a specified table-view cell.

[`indexPathForRow(at:)`](/documentation/UIKit/UITableView/indexPathForRow(at:))

Returns an index path that identifies the row and section at the specified point.

[`indexPathsForRows(in:)`](/documentation/UIKit/UITableView/indexPathsForRows(in:))

Returns an array of index paths, each representing a row that the specified rectangle encloses.

[`visibleCells`](/documentation/UIKit/UITableView/visibleCells)

The table cells that are visible in the table view.

[`indexPathsForVisibleRows`](/documentation/UIKit/UITableView/indexPathsForVisibleRows)

An array of index paths, each identifying a visible row in the table view.

### Selecting rows

[`indexPathForSelectedRow`](/documentation/UIKit/UITableView/indexPathForSelectedRow)

An index path that identifies the row and section of the selected row.

[`indexPathsForSelectedRows`](/documentation/UIKit/UITableView/indexPathsForSelectedRows)

The index paths that represent the selected rows.

[`selectRow(at:animated:scrollPosition:)`](/documentation/UIKit/UITableView/selectRow(at:animated:scrollPosition:))

Selects a row in the table view that an index path identifies, optionally scrolling the row to a location in the table view.

[`deselectRow(at:animated:)`](/documentation/UIKit/UITableView/deselectRow(at:animated:))

Deselects a row that an index path identifies, with an option to animate the deselection.

[`allowsSelection`](/documentation/UIKit/UITableView/allowsSelection)

A Boolean value that determines whether users can select a row.

[`allowsMultipleSelection`](/documentation/UIKit/UITableView/allowsMultipleSelection)

A Boolean value that determines whether users can select more than one row outside of editing mode.

[`allowsSelectionDuringEditing`](/documentation/UIKit/UITableView/allowsSelectionDuringEditing)

A Boolean value that determines whether users can select cells while the table view is in editing mode.

[`allowsMultipleSelectionDuringEditing`](/documentation/UIKit/UITableView/allowsMultipleSelectionDuringEditing)

A Boolean value that controls whether users can select more than one cell simultaneously in editing mode.

[`selectionFollowsFocus`](/documentation/UIKit/UITableView/selectionFollowsFocus)

A Boolean value that triggers an automatic selection when focus moves to a cell.

[`selectionDidChangeNotification`](/documentation/UIKit/UITableView/selectionDidChangeNotification)

A notification that posts when the selected row in the posting table view changes.

### Inserting, deleting, and moving rows and sections

[`insertRows(at:with:)`](/documentation/UIKit/UITableView/insertRows(at:with:))

Inserts rows in the table view at the locations that an array of index paths identifies, with an option to animate the insertion.

[`deleteRows(at:with:)`](/documentation/UIKit/UITableView/deleteRows(at:with:))

Deletes the rows that an array of index paths identifies, with an option to animate the deletion.

[`insertSections(_:with:)`](/documentation/UIKit/UITableView/insertSections(_:with:))

Inserts one or more sections in the table view, with an option to animate the insertion.

[`deleteSections(_:with:)`](/documentation/UIKit/UITableView/deleteSections(_:with:))

Deletes one or more sections in the table view, with an option to animate the deletion.

[`UITableView.RowAnimation`](/documentation/UIKit/UITableView/RowAnimation)

The type of animation to use when inserting or deleting rows.

[`moveRow(at:to:)`](/documentation/UIKit/UITableView/moveRow(at:to:))

Moves the row at a specified location to a destination location.

[`moveSection(_:toSection:)`](/documentation/UIKit/UITableView/moveSection(_:toSection:))

Moves a section to a new location in the table view.

### Performing batch updates to rows and sections

[`performBatchUpdates(_:completion:)`](/documentation/UIKit/UITableView/performBatchUpdates(_:completion:))

Animates multiple insert, delete, reload, and move operations as a group.

[`beginUpdates()`](/documentation/UIKit/UITableView/beginUpdates())

Begins a series of method calls that insert, delete, or select rows and sections of the table view.

[`endUpdates()`](/documentation/UIKit/UITableView/endUpdates())

Concludes a series of method calls that insert, delete, select, or reload rows and sections of the table view.

### Reloading the table view

[`hasUncommittedUpdates`](/documentation/UIKit/UITableView/hasUncommittedUpdates)

A Boolean value that indicates whether the table view’s appearance contains changes that aren’t present in its data source.

[`reconfigureRows(at:)`](/documentation/UIKit/UITableView/reconfigureRows(at:))

Updates the data for the rows at the index paths you specify, preserving the existing cells for the rows.

[`reloadData()`](/documentation/UIKit/UITableView/reloadData())

Reloads the rows and sections of the table view.

[`reloadRows(at:with:)`](/documentation/UIKit/UITableView/reloadRows(at:with:))

Reloads the specified rows using the provided animation effect.

[`reloadSections(_:with:)`](/documentation/UIKit/UITableView/reloadSections(_:with:))

Reloads the specified sections using the provided animation effect.

[`reloadSectionIndexTitles()`](/documentation/UIKit/UITableView/reloadSectionIndexTitles())

Reloads the items in the index bar along the right side of the table view.

### Managing drag interactions

[`dragDelegate`](/documentation/UIKit/UITableView/dragDelegate)

The delegate object that manages the dragging of items from the table view.

[`UITableViewDragDelegate`](/documentation/UIKit/UITableViewDragDelegate)

The interface for initiating drags from a table view.

[`hasActiveDrag`](/documentation/UIKit/UITableView/hasActiveDrag)

A Boolean value that indicates whether the table view is currently tracking a drag session.

[`dragInteractionEnabled`](/documentation/UIKit/UITableView/dragInteractionEnabled)

A Boolean value that indicates whether the table view supports dragging content.

### Managing drop interactions

[`dropDelegate`](/documentation/UIKit/UITableView/dropDelegate)

The delegate object that manages the dropping of content into the table view.

[`UITableViewDropDelegate`](/documentation/UIKit/UITableViewDropDelegate)

The interface for handling drops in a table view.

[`hasActiveDrop`](/documentation/UIKit/UITableView/hasActiveDrop)

A Boolean value that indicates whether the table view is currently tracking a drop session.

### Scrolling the table view

[`scrollToRow(at:at:animated:)`](/documentation/UIKit/UITableView/scrollToRow(at:at:animated:))

Scrolls through the table view until a row that an index path identifies is at a particular location on the screen.

[`scrollToNearestSelectedRow(at:animated:)`](/documentation/UIKit/UITableView/scrollToNearestSelectedRow(at:animated:))

Scrolls the table view so that the selected row nearest to a specified position in the table view is at that position.

[`UITableView.ScrollPosition`](/documentation/UIKit/UITableView/ScrollPosition)

The position in the table view (top, middle, bottom) to scroll a specified row to.

### Putting the table into edit mode

[`setEditing(_:animated:)`](/documentation/UIKit/UITableView/setEditing(_:animated:))

Toggles the table view into and out of editing mode.

[`isEditing`](/documentation/UIKit/UITableView/isEditing)

A Boolean value that determines whether the table view is in editing mode.

### Configuring the table index

[`sectionIndexMinimumDisplayRowCount`](/documentation/UIKit/UITableView/sectionIndexMinimumDisplayRowCount)

The number of table rows at which to display the index list on the right edge of the table.

[`sectionIndexColor`](/documentation/UIKit/UITableView/sectionIndexColor)

The color to use for the table view’s index text.

[`sectionIndexBackgroundColor`](/documentation/UIKit/UITableView/sectionIndexBackgroundColor)

The color to use for the background of the table view’s section index.

[`sectionIndexTrackingBackgroundColor`](/documentation/UIKit/UITableView/sectionIndexTrackingBackgroundColor)

The color to use for the table view’s index background area.

[`indexSearch`](/documentation/UIKit/UITableView/indexSearch)

A constant for adding the magnifying glass icon to the section index of a table view.

### Getting the drawing areas for the table

[`rect(forSection:)`](/documentation/UIKit/UITableView/rect(forSection:))

Returns the drawing area for a specified section of the table view.

[`rectForRow(at:)`](/documentation/UIKit/UITableView/rectForRow(at:))

Returns the drawing area for a row that an index path identifies.

[`rectForFooter(inSection:)`](/documentation/UIKit/UITableView/rectForFooter(inSection:))

Returns the drawing area for the footer of the specified section.

[`rectForHeader(inSection:)`](/documentation/UIKit/UITableView/rectForHeader(inSection:))

Returns the drawing area for the header of the specified section.

### Working with focus

[`allowsFocus`](/documentation/UIKit/UITableView/allowsFocus)

A Boolean value that determines whether the table view allows its cells to become focused.

[`allowsFocusDuringEditing`](/documentation/UIKit/UITableView/allowsFocusDuringEditing)

A Boolean value that determines whether the table view allows its cells to become focused in edit mode.

[`selectionFollowsFocus`](/documentation/UIKit/UITableView/selectionFollowsFocus)

A Boolean value that triggers an automatic selection when focus moves to a cell.

[`remembersLastFocusedIndexPath`](/documentation/UIKit/UITableView/remembersLastFocusedIndexPath)

A Boolean value that indicates whether the table view automatically returns the focus to the cell at the last focused index path.

### Managing context menus

[`contextMenuInteraction`](/documentation/UIKit/UITableView/contextMenuInteraction)

The table view’s context menu interaction.

### Resizing self-sizing cells

[`selfSizingInvalidation`](/documentation/UIKit/UITableView/selfSizingInvalidation-swift.property)

The mode that the table view uses for invalidating the size of self-sizing cells.

[`UITableView.SelfSizingInvalidation`](/documentation/UIKit/UITableView/SelfSizingInvalidation-swift.enum)

Constants that describe modes for invalidating the size of self-sizing table view cells.

### Managing content-hugging behavior

[`contentHuggingElements`](/documentation/UIKit/UITableView/contentHuggingElements)

A setting that determines which type of items tightly hug their content.

[`UITableViewContentHuggingElements`](/documentation/UIKit/UITableViewContentHuggingElements)

Constants that determine which types of items in a table view tightly hug their content.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)