-3

When should I either of these? Which of these is better suited, if I only need to group sub-views and hide/ show them based on a logic?

Zaxter
  • 2,939
  • 3
  • 31
  • 48

1 Answers1

1

You should be more clear with your question. From my understanding ...

When people talk about container views, they usually mean just a plain old UIView that contains other views. Using a view in that way lets you move all the views it contains as a group, so that their positions relative to each other are maintained. It also makes it easy to hide all the contained views as a group.

Adding subviews for small applications, will not consume much memory. While if you are going for huge applications, you must maintain a state, so that which view will be added to container view as subview at each state of your application.

for example:

state 1 - login
state 2 - Dashboard
state 3 - People VC

Each state points to each viewController. So you have to maintain a state machine for states and viewController in your application.

Vipin Vijay
  • 393
  • 5
  • 21