隐藏View的导航栏按下View是OK.but pop可以看到黑条

时间:2013-08-05 16:31:23

标签: ios push hidden pop navigationbar

SDK 6.1,目标6.1,使用故事板

aView有一个UIButton。我使用action segue [push]到bView

点击此按钮后,按bView即可

但我弹出aView有一个背栏,我该如何解决这个问题?

aView.m

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController.navigationBar setHidden:YES];
}

bView.m

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController.navigationBar setHidden:NO];
}

1 个答案:

答案 0 :(得分:1)

我得到了你的问题。您正在使用viewWillAppear: viewA方法隐藏导航栏,而您没有动画。

试试这个

// This will add an animation like slide out. So you may won't like it.
[self.navigationController setNavigationBarHidden:YES animated:YES];

如果它不起作用,请在bView.m

中添加此代码
- (void)viewWillDisappear:(BOOL)animated {
[self.navigationController setNavigationBarHidden:YES animated:NO];
[super viewWillDisappear:animated]
}