Edit button inside UITabBarController and UINavigationController

会有一股神秘感。 提交于 2019-12-11 05:18:17

问题


I just embedded my UINavigationController into a UITabBarController. I can no longer see my view title or edit button. Please see storyboard below. How do I make the edit button visible again?

My Storyboard:


回答1:


Rather than the following organization (which you're currently using):

NavController -> TabBarController -> ViewControllerA
                                  \
                                   -> ViewControllerB

You must do the following:

TabBarController -> NavControllerA -> ViewControllerA
                 \
                  -> NavControllerB -> ViewControllerB

UITabBarControllers should always be the root view. Each child view controller needs its own navigation controller to achieve the navigation bar + tab bar effect you desire. Here is an example of what the structure should look like:

As for adding navigation items / titles to each view controller once you've done the above, make sure to drag Navigation Items onto each view controller. You can find the Navigation Item in the Object Library at the bottom of the Utilities view:



来源:https://stackoverflow.com/questions/40509479/edit-button-inside-uitabbarcontroller-and-uinavigationcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!