Reputation: 363
I have a table view inside a normal view controller and I was wondering how I should go out populating it with data?
After researching it, everywhere I have seen it done uses a table view controller: I am just using a view controller with a table view inside it.
How should I populate this with data? I have created an IBOutlet in my ViewController.swift
, but I'm not sure what to do to add data.
The reason I am not using a table view controller is because I couldn't get the navigation bar to show up and I heard that the navigation bar scrolled.
Is it possible to use a table view inside a normal view controller? Should I be using table view controller? If it is possible to use a table view inside a normal view controller, how do I populate the table view?
The coding language I am using is swift.
Upvotes: 0
Views: 359
Reputation: 39081
A UITableViewController
is basically a normal UIViewController
which has its main view replaced with a UITableView
and uses the UITableviewDelegate
and UITableViewDataSource
protocols.
UITableViewController
is subclass of UIViewController
.
So just add the protocols and use it exactly the way you use it in UITableViewController
.
Upvotes: 1