UINavigationController的navigationBar消失
我有这个:
FirstViewController:
SecondViewController *secondViewController = [[SecondViewController alloc] init];
[self.navigationController pushViewController:secondViewController animated:YES];
SecondViewController:
- (void)viewDidLoad
{
[super viewDidLoad];
[self.navigationController setNavigationBarHidden:YES];
}
我的问题是,当我从 SecondViewController 返回到 FirstViewController 时,导航栏是仍然隐藏。有没有办法让它在我回到 FirstViewController 时出现?
I have this:
FirstViewController:
SecondViewController *secondViewController = [[SecondViewController alloc] init];
[self.navigationController pushViewController:secondViewController animated:YES];
SecondViewController:
- (void)viewDidLoad
{
[super viewDidLoad];
[self.navigationController setNavigationBarHidden:YES];
}
My problem is that when I comeback from SecondViewController to FirstViewController the NavigationBar is still hidden.Is there a way to make it appear when I'm back in FirstViewController?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 FirstViewController.m 中:
In the
FirstViewController.m
:是的,不同的导航控制器总是有可能将该栏设置为隐藏。因此,在您的
viewWillAppear
中设置标志如下:Yep, it's always possible that a different navigation controller will have set the bar to be hidden. So, in your
viewWillAppear
set the flag as follows:您需要设置 [self.navigationController setNavigationBarHidden:NO];
这样就可以了。
You need to set [self.navigationController setNavigationBarHidden:NO];
This will do.