2
votes

I've been developing an iOS application for 3 months. I know all MVC stuff, design issues and UIViewController capabilities comparing to those of UIView. However, I cannot find an answer to why using multiple UIViewControllers is a "should-to-do" for multiple screens. For example, instead of using one UITabBarController and one UIViewController for each tab, we can have single UIViewController, which is root view controller, and one UIView for each tab. Then, to provide tab functionality, we can use hidden property of UIView. In other words, for instance, to show the first tab, we set hidden = true of all UIViews (corresponding to a tab) other than UIView corresponding to the first tab.

What is the problem aside from design issues in this approach? Time&memory efficiency, segue animations etc.?

Thanks in advance...

1
Besides the issues that Boda Sira brings up in his answer, you can't do this with a UITabBarController. You could switch views using a stand-alone tab bar, but a tab bar controller's tabs only switch between different controllers.rdelmar

1 Answers

0
votes

Yes, you can use single controller and multiple views and swap between them when needed. (for simple use cases)

But if the functionality in each tab is complex and unrelated to each other, then its always better to go for multiple controllers.
Suppose you are building a tabbed twitter application using open source API available,with first tab for timeline, second tab for your interactions,third for profile then for settings so on. In this case each tab will have complex set of functionalities and its better to delegate related tasks to different controllers.

Hope you found a answer!