mrGott
mrGott

Reputation: 1076

TabBarController and TableViews

I'm very new to iOS development but I can do tables and many stuff I guess. I haven't built anything just yet. So I'm building a tabBar based application, with 2 tabs. On both of them I'm having TableViews. Both are identical but with different data loaded. I have two viewControllers that extend UIViewController. These viewControllers classes are assigned to Views that have tables on them and segmented controls.enter image description here This is a screenshot just in case :) I'm thinking to create UITableViewController that will work for both tables. What I'm thinking is to have a custom initializer inside TableViewController where I'll pass tableName and data from my UIViewController.

So a newbie questions: Is this a right way to do this? What would you guys recommend? Sorry if it's too silly but I couldn't find solution to this question.

Upvotes: 0

Views: 41

Answers (1)

zsteed
zsteed

Reputation: 97

No do not user one UITableViewController for two different views. First off it is bad practice and second you can't use a UITableViewController on a UIViewController. If you are thinking of adding a custom class to the tableView that is not how a UITableViewController works. Just makes sure to have two different custom classes for each view you are working with.

Upvotes: 1

Related Questions