Changing view controller when Segmented Control changes

前端 未结 4 1644
终归单人心
终归单人心 2020-12-02 16:17

This problem is driving me crazy. I\'m trying to change the viewController when the user changes the selected \"tab\" of the segmented control. I\'ve spent a co

4条回答
  •  [愿得一人]
    2020-12-02 16:46

    I'd say it's much simpler to change subviews within a UIViewController, you can set up your subviews in your storyboards and hook them up with IBOulets in your controller you can set the hidden property of your views to YES or NO depending on the control that was clicked.

    Now, if you use @Robotic Cat's approach which is also a good solution you can have a little more modularity in how your app works, considering you'd have to place all your logic in one controller using the solution I presented.

提交回复
热议问题