将视图重构为情节提要时,UINavigationItem 会消失到哪里? [英] Where is UINavigationItem disappearing to when refactoring views to storyboard?

查看:26
本文介绍了将视图重构为情节提要时,UINavigationItem 会消失到哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Swift 4/Xcode 9.2 重写一个 Obj-C 项目

I'm rewriting an Obj-C project using Swift 4 / Xcode 9.2

我有一个很大的故事板,我正在将其分解为多个故事板.我以前这样做没有任何问题.如果我将一些视图重构为它们自己的故事板,那么这些视图会带走导航项.现在它们消失了......

I have a large storyboard that I am breaking down into multiple storyboards. I did this previously without any issues. If I refactored a few views to their own storyboard then the views took the navigation item with them. now they disappear...

[

我的问题是......

My questions are ...

这是 Xcode 的错误吗?还是新功能?

Is this an Xcode bug? or a new feature?

显然你可以解决这个问题,就像我在图片中展示的那样,但有没有办法阻止这种消失的发生?

Obviously you can work around this as I have shown in the pictures but is there a way to stop the vanishing from happening?

推荐答案

这是一直以来的方式.在您的故事板中,如果视图控制器不是通过根视图控制器或推送segues 成为导航控制器的子级,则默认情况下故事板中不会显示导航栏.不过,您可以通过转到属性检查器"选项卡的模拟指标"部分并为顶部栏"选择导航栏选项之一来强制启用它.

This is the way it's always been. In your storyboard, if a view controller is not a child of a navigation controller via root view controller or push segues, then by default no navigation bar is shown in the storyboard. You can force it on, though, by going to the Simulated Metrics section of the Attributes Inspector tab and selecting one of the navigation bar options for "Top Bar".

这篇关于将视图重构为情节提要时,UINavigationItem 会消失到哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆