Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storyboard - container view - embed different views based on condition

In my storyboard app I have view hierarchy like this:

  1. ParentViewController has a container view (dragged and dropped the container view from library on to the view of parent view controller).

2. Container view can embed one of the three view controllers, based on some condition.

While implementing second point I am facing problem.

If I try to do it in storyboard by control dragging from container view to a view controller, I can select viewDidLoad - embed segue. This will automatically embed the destination view controller, but then I will have no option to embed other view controllers based on some condition, say on tap of a different button.

Can anyone suggest me how can I implement the 2nd point?

like image 485
Devarshi Avatar asked Aug 16 '13 17:08

Devarshi


1 Answers

There is another solution: you can have three containers, each with it's own segue to another View Controller. Show one container and hide another two.

like image 176
Borzh Avatar answered Nov 12 '22 16:11

Borzh