How to resize UINavigationController in a storyboard editor

雨燕双飞 提交于 2019-12-22 04:15:18

问题


When I want resize an UIViewController in a storyboard editor window I do:

  • I put size to "freeForm" in the UIViewController attributes inspector
  • I select the view and resize her with the size inspector

after that, the uiViewController is resized in storyboard window.

Next, I select the view controller, click on: edit > embeded in> Navigation Controller and the problem is that navigation controller is in full size and not the same size that UIViewController. I don't find how resize this navigation controller.


回答1:


You don't resize a NavigationController - it is not a ViewController. It controls the navigation of ViewControllers. You specify an initial ViewController (the one you embedded into it will be the initial viewController by default). You then create segues into other ViewControllers.




回答2:


There's a trick to get around this limitation. Add a view controller to your storyboard and then add a Container View as a subview to it's view. Size that container view to the size you want the navigation controller (and it's children) and then control drag from the container controller to your navigation controller. You can then instantiate the navigation controller by identifier and the container view controller will be ignored.



来源:https://stackoverflow.com/questions/9195143/how-to-resize-uinavigationcontroller-in-a-storyboard-editor

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