How to resize UINavigationController in a storyboa

2019-04-21 12:19发布

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.

2条回答
仙女界的扛把子
2楼-- · 2019-04-21 12:36

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.

查看更多
啃猪蹄的小仙女
3楼-- · 2019-04-21 12:40

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.

查看更多
登录 后发表回答