简体   繁体   English

如何在当前vc上获取largeTitle,但将vc上的小标题推入?

[英]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.

相关问题 如何通过关闭推送的VC来在MasterVC上调用函数? - How can I call a function on a MasterVC, executed by the dismissal of a pushed VC? 如何从在情节提要中定义了segue的推送的vc执行segue - How to perform a segue from a pushed vc that has the segue defined in the storyboard 释放当前 VC 并推送不同的 VC - Deallocate current VC and push a different VC 如何将标题从UIAlertAction发送到另一个VC的UIViewController - How to send the title from UIAlertAction to another UIViewController as title of that VC 从 VC 上的 3 个不同按钮到要显示为标题的第二个 VC 的数据 - Data from 3 different buttons on a VC to a second VC to be displayed as title 正在调用 CollectionView `DidSelect` 方法但没有推送下一个 VC,如何解决? - CollectionView `DidSelect` method is being called but not pushing the next VC, how to fix it? 通过 UITabBarController 让目标 VC 知道当前 VC 是委托的 - Let destination VC know current VC is delegate through UITabBarController 如何从包含在一个 VC 中的一个 VC 转换为将包含在与另一个相同的 VC 中的新 VC? - How to transition from one VC contained in one VC, to a new VC which will be contained in the same VC as the other? 出现 VC 时显示取消按钮,按下同一个 VC 时不显示取消按钮 - Display cancel button when the VC is presented, don't display cancel button when the same VC is pushed 获取topVC或Visible VC,并检查堆栈中是否有特定的VC - Get the topVC or Visible VC and check if a specific VC is in the stack
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM