iOS Reference Library Apple Developer
Search

UITableViewController Class Reference

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

Overview

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

You create a custom subclass of UITableViewController for each table view that you want to manage. When you initialize the controller in initWithStyle:, you must specify the style of the table view (plain or grouped) that the controller is to manage. Because the initially created table view is without table dimensions (that is, number of sections and number of rows per section) or content, the table view’s data source and delegate—that is, the UITableViewController object itself—must provide the table dimensions, the cell content, and any desired configurations (as usual). You may override loadView 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.

Tasks

Initializing the UITableViewController Object

Getting the Table View

Configuring the Table Behavior

Properties

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

clearsSelectionOnViewWillAppear

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

@property(nonatomic) BOOL clearsSelectionOnViewWillAppear

Discussion

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

Availability
  • Available in iOS 3.2 and later.
Declared In
UITableViewController.h

tableView

Returns the table view managed by the controller object.

@property(nonatomic, retain) UITableView *tableView

Availability
  • Available in iOS 2.0 and later.
Declared In
UITableViewController.h

Instance Methods

initWithStyle:

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

- (id)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 or nil if the object couldn’t be created.

Discussion

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

Availability
  • Available in iOS 2.0 and later.
Related Sample Code
Declared In
UITableViewController.h



Last updated: 2010-02-25

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