[英]how to get largeTitle on current vc, but small title on vc being pushed to?
I have a simple "more" screen where I want to have a largeTitle
. 我有一个简单的“更多”屏幕,我想要一个
largeTitle
。 I have several entries in a static table view which are leading to other view controllers. 我在静态表视图中有多个条目,这些条目通向其他视图控制器。 I want to have the large title in the "more" screen, but not in the screens pushed to.
我希望在“更多”屏幕中具有较大的标题,但在推送至的屏幕中却没有。 Either are all of the titles large or all small.
所有标题都是大字体还是小字体。 How do I do it?
我该怎么做? I am using the storyboard.
我正在使用情节提要。
Did you try to set 您是否尝试设定
self.navigationController?.navigationBar.prefersLargeTitles = false
in your second View Controller? 在您的第二个View Controller中?
On the detail vc set the following: 在详细信息vc上设置以下内容:
self.navigationItem.largeTitleDisplayMode = .never
If you access the navigationItem
of the navigationController
, it will change all detail vc, but if you access the navigationItem
of the detailVC, it will only change the current title in the navigationBar
. 如果您访问
navigationItem
中的navigationController
,它将改变一切的细节VC,但是如果你访问navigationItem
的detailVC的,它只会更改当前标题navigationBar
。
You cannot do that in Storyboard, because you cannot click on the navigationBar
itself in the detail vc. 您无法在情节提要中执行此操作,因为您无法单击详细信息vc中的
navigationBar
本身。
More information available in a WWDC video from 2017 . 2017年的WWDC视频中提供了更多信息。
Because there is only one navigation controller
which stacks all your views, you can try to write 因为只有一个
navigation controller
可以堆叠所有视图,所以您可以尝试编写
self.navigationController?.navigationBar.prefersLargeTitles = false
in the viewWillApear
method of the second viewController and on viewWillDisappear
you can change it again to 在第二个viewController的
viewWillApear
方法中,在viewWillDisappear
您可以再次将其更改为
self.navigationController?.navigationBar.prefersLargeTitles = true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.