0

I am designing an tab bar / navigation style app and I've added TableViews using both methods. Is there a preferred method and what are the pros and cons of using a UITableViewController vs putting UITableView inside UIViewController

I will need navigation item bars on top, informational labels, and navigation buttons on the bottom.

Thanks in advance.

branimal
  • 97
  • 9
  • Does this answer your question? [UITableViewController vs TableView](https://stackoverflow.com/questions/9694185/uitableviewcontroller-vs-tableview) – Declan McKenna Aug 16 '20 at 10:38

1 Answers1

0

UITableViewController can have static cells. TableView in a ViewController cannot.

Your labels will scroll with the tableview if you use a TableViewController unless you implement extra code to prevent it. With a UITableView the labels on top would stay in place automatically when scrolling.

Navigation Bar on top will always remain on top regardless.

rmickeyd
  • 1,551
  • 11
  • 13
  • 2
    Are we talking about the same static cells? Because I'm pretty sure it's possible for both of them. – Eendje Mar 31 '16 at 15:55
  • 1
    "One more thing about static cells: they only work in UITableViewController." taken from: https://www.raywenderlich.com/113394/storyboards-tutorial-in-ios-9-part-2 – rmickeyd Mar 31 '16 at 16:28
  • Unless something has changed in the most recent update of Xcode they will not work in a UITableView only UITableViewController. – rmickeyd Mar 31 '16 at 16:31
  • Actually, at this very moment, I'm working in an `UIViewController` where I've manually added an `UITableView` with static cells. Perhaps it's not possible using the storyboard, because I usually do everything programmatically. – Eendje Mar 31 '16 at 16:33
  • Storyboards will let you add them and then give you an error when you try to build. If you want static content you can just create a prototype use it once and never change it. It becomes more of an issue if you want to add something like a UITextField to your cell. This is something I tried in the past and was forced to use a UITableViewController with static cells. – rmickeyd Mar 31 '16 at 16:38