简体   繁体   English

从自定义导航栏取消搜索后,如何切换回默认导航栏外观?

[英]How do I switch back to default navigation bar appearance after unwind segue from custom nav bar?

Have a question on segues and custom navigation appearances. 对segues和自定义导航外观有疑问。 Image 1 shows a search vc with navigation bar appearance set by my app delegate. 图1显示了由我的应用程序代表设置的带有导航栏外观的搜索vc。 As I search and segue to my detail vc, I have a custom navigation bar view in view did load (image 2). 当我搜索并搜索到我的详细信息vc时,确实加载了一个自定义导航栏视图(图2)。 It's transparent. 它是透明的。 When i click back to the search vc, that custom appearance tags along as you can see in image 3. How do I revert back to the original nav bar appearance? 当我单击返回搜索vc时,该自定义外观标签将如您在图像3中看到的那样。如何恢复为原始的导航栏外观? I assume this is done in view will appear? 我认为这样做会在视图中出现?

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

You are right, there's only one nav bar for all controllers in the navigation controller, so when you go back to the first controller you have to programmatically modify the appearance of the navigation bar to be the way it was before the segue; 没错,导航控制器中的所有控制器只有一个导航栏,因此,当您返回第一个控制器时,必须以编程方式修改导航栏的外观,使其与之前的设置相同。 viewWillAppear is a good place to do so. viewWillAppear是这样做的好地方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM