Adam Johns
Adam Johns

Reputation: 36373

UITableViewController vs UIViewController

What all does UITableViewController get me that makes it actually useful? Is there any bonus is using it instead of just using a UIViewController for views with UITableViews in them? I ask because I want my views with UITableViews to inherit from a base view controller (which inherits from UIViewController). If I use a UITableViewController then having a base class for all my views becomes more difficult.

Upvotes: 23

Views: 7017

Answers (3)

peter
peter

Reputation: 181

Well I do think both Retro and matt's answer are correct, from personal experience it is much easier and less "hackY" to use UITableViewController with UIRefreshControl, then trying to get UIRefreshControl work with UIViewController with a UITableView.

Upvotes: 7

Retro
Retro

Reputation: 4005

Nothing more then the boilerplate code ready for setting the data source and connection to your tableView object, some getters and setter to make your life easy if you not want to put your effort to do the same thing which is available.

But in your case for SubClass its not fit to have UItableViewController

Upvotes: 2

matt
matt

Reputation: 535566

Not much. It provides some conveniences, but you never really need it; I often don't use it.

The main things, aside from the automatic setup when you create one in the storyboard, are the three properties tableView, clearsSelectionOnViewWillAppear, and refreshControl. But they don't do anything you can't do yourself.

Upvotes: 23

Related Questions