隐藏导航栏,但是当我转换到上一个视图(弹出)时,它会暂时显示旧的后退按钮。为什么? [英] Hide navigation bar, but when I transition to the previous view (popped) it shows the old back button temporarily. Why?
问题描述
我在导航控制器中有视图控制器(root: RootViewController
,第二个: ReadingViewController
),但在第二个视图控制器我想禁用 UIToolBar
的导航栏(因为我不需要标题,想要更多按钮,比如在iBooks或Facebook应用程序中)。问题是,当我在第二个视图中隐藏导航栏时,当我弹出视图控制器(返回)时,它会再次随机出现一秒钟。
I have view controllers in a navigation controller (root: RootViewController
, second: ReadingViewController
), but in the second view controller I want to disable the navigation bar for a UIToolBar
(as I don't need the title and want more buttons, like in iBooks or the Facebook app). Problem is, when I hide the navigation bar in the second view, it appears randomly for a second again when I pop the view controller (go back).
当我弹出时视图控制器后退按钮出现一秒钟:
When I pop the view controller the back button appears for a second:
在第二个视图控制器中,我隐藏中的导航栏viewWillAppear:
:
In the second view controller I hide the nav bar in viewWillAppear:
:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:YES];
}
同样在第二个视图控制器中,我恢复<$ c中的导航栏$ c> viewWillDisappear::
Also in the second view controller, I restore the nav bar in viewWillDisappear:
:
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
// ... other stuff
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
我想知道如何解决这个问题,以便视图控制器无缝过渡。
I'm wondering how I combat this issue so that the view controllers transition seamlessly.
推荐答案
嘿,为什么不使用导航栏作为 UIToolbar
。
Hey why don't you use navigation bar as a UIToolbar
.
您可以将导航控制器模仿到 UITootlbar
通过向其添加按钮。
Instead Of hiding UINavigation
you can mimic navigation controller to UITootlbar
by adding buttons to it.
隐藏取消隐藏 UINavigation
将会很复杂。
hiding unhiding UINavigation
would be complex.
我上传了Dropbox 链接。
I am Uploaded the dropbox link.
这篇关于隐藏导航栏,但是当我转换到上一个视图(弹出)时,它会暂时显示旧的后退按钮。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!