简体   繁体   English

无导航栏的模态搜索到导航控制器

[英]Modal Segue Into Navigation Controller with No Nav Bar

In my storyboard I have a view with a segue into a new view that's embedded into a Navigation Controller (so the segue points to the navigation controller). 在我的情节提要中,我有一个带有segue的视图,并嵌入到导航控制器中的新视图中(因此,segue指向导航控制器)。 I have the segue set to a Modal transition, however when the new view is animating up, it contains the standard blue navigation bar above the view (which then animates out of view). 我已将segue设置为Modal过渡,但是在对新视图进行动画处理时,它在视图上方包含标准的蓝色导航栏(然后在动画视图之外进行动画处理)。

Here's what it looks like mid segue: http://i.imgur.com/3eqAQ.png 这是中途搜索的样子: http : //i.imgur.com/3eqAQ.png

How do I make it so the modal view animates up but without the navigation bar? 如何使模态视图动画化但没有导航栏?

I have tried hiding the navigation bar in the embedded view's init, viewWillAppear , and vieWillLoad methods and that doesn't work. 我曾尝试将导航栏隐藏在嵌入式视图的init, viewWillAppearvieWillLoad方法中,但vieWillLoad方法不起作用。

I event went so far as to create a custom subclass of UINavigationController and set the navigation controller in the storyboard to it. 我事件竟然可以创建UINavigationController的自定义子类,并在情节UINavigationController设置导航控制器。

Thanks! 谢谢!

This may sound pretty simple, but have you tried hiding the navigation bar immediately before the modal segue starts? 这听起来很简单,但是您是否已尝试在模态搜索开始之前立即隐藏导航栏? I had this problem when presenting a modal view controller and adding a [self.navigationController setNavigationBarHidden:YES] immediately before the presentation did the trick for me. 在演示模态视图控制器并在演示文稿对我起作用之前立即添加[self.navigationController setNavigationBarHidden:YES]时,我遇到了这个问题。

I had almost the same problem, but I wanted to get a navigation bar for my modal transition, as it was always hidden. 我几乎遇到了同样的问题,但是我想为我的模式转换获得一个导航栏,因为它始终是隐藏的。 There may be two ways for you to remove the navigation bar: 删除导航栏的方式可能有两种:

  • Make sure that your view controller is not embed in a navigation controller, as it would put one by default 确保您的视图控制器未嵌入导航控制器,因为默认情况下会放置一个
  • Check the "Top Bar" attribute of your previous controller in the workflow and work with none/inferred values depending on your storyboard. 在工作流中检查先前控制器的“顶部栏”属性,并根据情节提要使用无/推断值。

Regards 问候

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

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