What is difference between UITableViewController and UIViewController?

UItableViewController and UIViewController are two different objects of iOS UIKit framework. Both are used for different purpose.

A UIViewController class manages a ViewContoller which is responsible for actions that happen within that View controller. This class is aware of actions that happen on view controller, like ViewDidLoad, ViewWillApper, ViewDidAppear, ViewWillDisapper, ViewDidDisapper.

Whereas, A UITableViewController is responsible for managing a table, it's data and it's events using UITableViewDataSource, UITableViewDelegate.

A UITableViewController conforms to UIViewController, UITableViewDataSource and UITableViewDelegate to implement table view.

Below is an example of a class implementing UIViewController.

class ViewController : UIViewController {
   @IBOutlet weak var sampleView: UIView!
   override func viewDidLoad() {

A UITableViewController also conforms to a UIViewController, hence it can implement the methods of a UIViewController. UITableViewController is used mostly if that ViewController does not have any other content except Table View.

If the view controller has other content along with a tableView, we mostly conform it to a UIViewController and implement the protocols of Table View that are UITableViewDataSource to assign some source of data to that table and UITableViewDelegate to handle events on that table view.

An example of UIViewController implementing UITableViewDataSource or UITableViewDelegate is

class ViewController : UIViewController, UITableViewDataSource, UITableViewDelegate {
   override func viewDidLoad() {
   func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) −> Int {
   func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) −> UITableViewCell {

Apart from the above there are some other properties of table view that are mentioned below.

  • When the table view is about to appear it reloads it's data.

  • Table view clears it's selection by default when it appears.

  • When the table view appears on screen, it's scroll indicators are flashed. This is done within viewDidAppear() method.

Updated on: 30-Jul-2019


Kickstart Your Career

Get certified by completing the course

Get Started