Change Container View Content with Tabs in iOS

前端 未结 5 1837
陌清茗
陌清茗 2021-01-30 18:52

I\'m trying to make a form that spans three tabs. You can see in the screenshot below where the tabs will be. When the user taps a tab, the Container View should update and show

5条回答
  •  借酒劲吻你
    2021-01-30 19:01

    Update: UITabBarController is the recommended way to go, as you found out earlier. In case you'd like to have a custom height, here is a good start: My way of customizing UITabBarController's tabbar - Stackoverflow answer

    As of iOS 5+ you have access to customize the appearance via this API; UIAppearance Protocol Reference. Here is a nice tutorial for that: How To Customize Tab Bar Background and Appearance

    The most obvious way to achieve what you're looking for is to simply manage 3 different containers (they are simple UIViews) and implement each of them to hold whatever content view you need for each tab (use the hidden property of the containers).

    Here is an example of what's possible to achieve with different containers:

    Embed View Controllers

    These containers "swapping" can be animated of course. About your self-answer, you probably chose the right way to do it.

提交回复
热议问题