[英]iOS Push Navigation Controller, without a bar on the second view
I have an iOS App, designed within a UINavigationController. 我有一个iOS应用程序,在UINavigationController中设计。 One of the pushed view controllers, however, needs a full screen view, without the navigation bar on the top.
但是,其中一个推式视图控制器需要全屏视图,而顶部没有导航栏。 (to get back, there is just a small, circular button).
(要返回,只有一个小的圆形按钮)。 However, any method I've tried of 'hiding' the navigation bar (navigationCtl.navigationBar.hidden=TRUE) leaves me with ugly artifacts - calling that before the view is pushed (in viewDidLoad or viewWillAppear) causes the previous view controllers bar to flash white just as the slide left animation starts.
但是,我尝试过的“隐藏”导航栏的任何方法(navigationCtl.navigationBar.hidden = TRUE)都给我留下了丑陋的瑕疵-在调用视图之前(在viewDidLoad或viewWillAppear中)调用该方法会导致先前的视图控制器栏左滑动动画开始时闪烁白色。 Similarly, calling it in viewDidAppear leaves a white bar at the top of the second view, along with several subviews pushed down, out of the way.
同样,在viewDidAppear中调用它会在第二个视图的顶部留下一个白条,并向下推几个子视图。 Is there any way I can just have the new view slide over as it usually does, but when it comes over, there's simply no navigation bar up top?
有什么办法可以像平常一样使新视图滑过,但是当它滑过时,顶部根本没有导航栏?
Please note, to help Google, essentially the question here is: 请注意,为帮助Google,本质上,这里的问题是:
How to animate between two UIViewControllers, when one has a navigation bar at the top, and the other one does not have a navigation bar at the top. 当一个UIViewControllers顶部具有导航栏,而另一个UI顶部没有导航栏时,如何在两个UIViewControllers之间设置动画。 So, how to navigate from a UIViewController with a navbar to one without a navbar - avoiding the horrible flickering.
因此,如何从具有导航栏的UIViewController导航到没有导航栏的UIViewController-避免可怕的闪烁。
The amazing answer is given below by Ev ... awesome. 令人惊奇的答案是由Ev在下面给出的。
give this a spin and see how it works for you. 旋转一下,看看它如何为您工作。
in the destination view controller in viewWillAppear 在viewWillAppear的目标视图控制器中
- (void)viewWillAppear:(BOOL)animated {
[self.navigationController setNavigationBarHidden:YES animated:YES];
}
It actually has a cool effect and can be useful. 它实际上具有很酷的效果,并且很有用。 in the viewWillAppear everything happens before the view is displayed so it takes away the strange artifacts.
在viewWillAppear中,一切都在显示视图之前发生,因此它消除了奇怪的工件。
be well 很好
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.