Embedding an existing UINavigationController to new view controllers

橙三吉。 提交于 2019-12-11 02:27:27

问题


Suppose I have a storyboard with a navigation controller and several view controllers.

All is well until I try to add a new view controller and would like to associate it with the existing UINavigationController. When I go to Editor>Embed>Navigation Controller, Xcode helpfully creates a new controller, which is precisely what I don't want. When I attempt to drag to create a wireframe, I create a segue relationship, which again is what I don't want.

Is there a way to make new view controllers play nice with an existing nav controller?


回答1:


I think you are thinking of the UINavigationController incorrectly. UINavigationController is just a container view controller that manages a hierarchy of view controllers. You start with one UINavigationController, which has exactly one root view controller (it sounds like you want more than one, which isn't going to happen). When you push a new view controller, it is pushed onto the same UINavigationController. So if you want multiple view controllers associated with a single UINavigationController, they have to hierarchically stack onto the root view controller.



来源:https://stackoverflow.com/questions/10201070/embedding-an-existing-uinavigationcontroller-to-new-view-controllers

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