Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Table Views. View controller vs Table View controller?

I have been watching a lot of tutorials on Table Views, table view cells etc. When creating a table view why choose a UIViewController over a UITableViewController in Xcode? For instance what would be the main benefits of creating a UIViewController and then adding a tableView object, over just creating a UITableViewController? I have already created a large numbers of scenes within storyboard and I hope I haven't limited myself in doing so. I hope my question is clear as I am new to coding!

like image 872
ProToolsIsKey Avatar asked Apr 25 '14 19:04

ProToolsIsKey


People also ask

What is TableView in iOS Swift?

Overview. Table views in iOS display rows of vertically scrolling content in a single column. Each row in the table contains one piece of your app's content. For example, the Contacts app displays the name of each contact in a separate row, and the main page of the Settings app displays the available groups of settings ...

What is the difference between a view and a view controller?

The view renders presentation of the model in a particular format. The controller responds to the user input and performs interactions on the data model objects. The controller receives the input, optionally validates it and then passes the input to the model.

What is a table view controller?

A TableViewController can be defined as a ViewController that specializes in managing the tableview. The TableViewController is responsible for maintaining the table along with its data and events. For this purpose, it uses the delegate and DataSource of its tableview property.

What is the difference between table View and table View Controller?

A TableViewController is a ViewController with a TableView built in. This will have the delegate methods needed already declared and setup. This VC is already a TableView delegate and datasource. It cannot be resized.


1 Answers

UIViewController gives you more control over tableview rather than UITableViewController. You should use UITableViewController only when you are just concerned with tableview in a controller. But if you want to add more subviews/controls in a controller other than tableview, then you have to use UIViewController.

EXAMPLE:

If you just want to display grocery items list with some header and footer, then tableviewcontroller should be priority. But if you want to display mail items in tableview, you would need some additional buttons for altering items in mail(tableview). For later case, you will use viewcontroller. Hope my point is clear.

like image 176
NightFury Avatar answered Sep 20 '22 19:09

NightFury