简体   繁体   English

iOS Push Navigation Controller,第二个视图上没有栏

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

相关问题 iOS导航栏,无控制器推送 - iOS navigation bar with push without controller 无法从AppDelegate推送到View Controller而不会丢失导航栏和标签栏设置iOS - Can't push to View Controller from AppDelegate without losing Navigation Bar and Tab Bar setup iOS 如何将视图控制器推送到iOS中标签栏中的导航控制器 - how to push a view controller to a navigation controller in a tab bar in iOS 推送/弹出视图控制器,带有导航栏,来自View Controller,不带导航栏 - Push / Pop View Controller With Navigation Bar from View Controller Without Navigation Bar iOS 13 中第二个视图的导航栏按钮 alignment 错误 controller - Wrong alignment of navigation bar button for second view controller in iOS 13 展示第二个视图控制器而不会丢失导航栏 - Presenting second view controller without loosing navigation bar 没有导航栏的iOS导航控制器 - iOS navigation controller without navigation bar iOS状态栏-View Controller到Navigation Controller - iOS status bar - View Controller to Navigation Controller 在没有导航控制器的情况下向视图添加导航栏 - Add a navigation bar to a view without a navigation controller iOS:关闭视图控制器并推送新视图,而不在导航堆栈中显示当前视图 - iOS: Dismiss view controller and push new view without showing the current view in navigation stack
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM