Change views using Segmented Control

前端 未结 2 654
夕颜
夕颜 2021-02-06 18:03

I need to change views using a Segmented Control. In the following example I have put two view containers in the same location:

The second container is hidden a

2条回答
  •  孤城傲影
    2021-02-06 18:39

    1. Would be great if you can send me a project. But maybe it's not needed if you can try to follow next steps.

    2. I would do it a different way. In your VC add the UIView. Call it container view. Then create 2 separate views in xib (nib) more here and here. and then add these 2 views into container view: view.addSubsire(view1) and view.addSubsire(view2)

    3. Then as you did just check the segmented control and show the view you need.

    4. Don't forget about UI Debugging. Use this amazing feature: link

    It might take some time to implement but these are the basics that you need to know in any case so it definitely would be useful.

    Hope it helps! Good luck!

    PS. The answer posted above - not sure if it helps since you need the tabs to be half page?

提交回复
热议问题