iOS Developer Library — Pre-Release

Developer

UIKit Framework Reference UITableViewController Class Reference

Options
Deployment Target:

On This Page
Language:

UITableViewController

The UITableViewController class creates a controller object that manages a table view. It implements the following behavior: More...

Inheritance


Import Statement


Swift

import UIKit

Objective-C

@import UIKit;

Availability


Available in iOS 2.0 and later.
  • init(style:) - initWithStyle: Designated Initializer

    Initializes a table-view controller to manage a table view of a given style.

    Declaration

    Swift

    init(style style: UITableViewStyle)

    Objective-C

    - (instancetype)initWithStyle:(UITableViewStyle)style

    Parameters

    style

    A constant that specifies the style of table view that the controller object is to manage (UITableViewStylePlain or UITableViewStyleGrouped).

    Return Value

    An initialized UITableViewController object.

    Discussion

    If you use the standard init method to initialize a UITableViewController object, a table view in the plain style is created.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 2.0 and later.

  • tableView tableView Property

    Returns the table view managed by the controller object.

    Declaration

    Swift

    var tableView: UITableView!

    Objective-C

    @property(nonatomic, retain) UITableView *tableView

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 2.0 and later.

  • A Boolean value indicating if the controller clears the selection when the table appears.

    Declaration

    Swift

    var clearsSelectionOnViewWillAppear: Bool

    Objective-C

    @property(nonatomic) BOOL clearsSelectionOnViewWillAppear

    Discussion

    The default value of this property is YEStrue. When YEStrue, the table view controller clears the table’s current selection when it receives a viewWillAppear: message. Setting this property to NOfalse preserves the selection.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 3.2 and later.

  • The refresh control used to update the table contents.

    Declaration

    Swift

    var refreshControl: UIRefreshControl?

    Objective-C

    @property(nonatomic, retain) UIRefreshControl *refreshControl

    Discussion

    The default value of this property is nil.

    Assigning a refresh control to this property adds the control to the view controller’s associated interface. You do not need to set the frame of the refresh control before associating it with the view controller. The view controller updates the control’s height and width and sets its position appropriately.

    The table view controller does not automatically update table’s contents in response to user interactions with the refresh control. When the user initiates a refresh operation, the control generates a UIControlEventValueChanged event. You must associate a target and action method with this event and use them to refresh your table’s contents.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later.