A view controller that specializes in managing a table view.
SDKs
- iOS 2.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
Framework
- UIKit
Declaration
@interface UITableViewController : UIView Controller
Overview
Subclass UITable
when your interface consists of a table view and little or no other content. Table view controllers already adopt the protocols you need to manage your table view's content and respond to changes. In addition, UITable
implements the following behaviors:
It automatically loads the table view archived in a storyboard or nib file. Access the table view using the
table
property.View It sets the data source and the delegate of the table view to
self
.It implements the
view
method and automatically reloads the data for its table view on first appearance. It clears its selection (with or without animation, depending on the request) every time the table view is displayed; you can disable this behavior by changing the value in theWill Appear: clears
property.Selection On View Will Appear It implements the
view
method and automatically flashes the table view's scroll indicators when it first appears.Did Appear: It implements the
set
method and automatically toggles the edit mode of the table when the user taps an Edit|Done button in the navigation bar.Editing: animated: It automatically resizes its table view to accommodate the appearance or disappearance of the onscreen keyboard.
Create a custom subclass of UITable
for each table view that you manage. When you initialize the table view controller, you must specify the style of the table view (plain or grouped). You must also override the data source and delegate methods required to fill your table with data. You may override load
or any other superclass method, but if you do, be sure to invoke the superclass implementation of the method, usually as the first method call.