Reputation: 18308
I would like to implement a simple UI which has one switch button, when switch is turned on the app shows one view, when turned off shows another view. (There is also an main button at the bottom which should always be visible no matter which UIView
is shown)
I am thinking on storyboard, I use one UIVIewController
, then define two UIView
components each represent one view.
So, in short, I would like to show different UIViews at runtime between the switch button and the Main button.
But I get stuck, I am not sure how to show one of the UIView
by default with my planned solution above. (Probably I am not sure whether it is correct way to do what I want to achieve.) Could someone please guide me a bit?
Upvotes: 1
Views: 364
Reputation: 26385
You can use 2 different approaches:
UIView
animation, for instance this method transition(from:to:duration:options:completion:)
Upvotes: 0
Reputation: 2200
Within a storyboard you could add two container views. These are basically UIViewController added as children. Based on the switch, you could hide/show with the isHidden parameter one or the other.
Upvotes: 1