hideController工具栏在隐藏后不会再出现

时间:2012-11-01 01:16:16

标签: iphone objective-c ios uinavigationcontroller toolbar

在我的appDelegate中,在 applicationDidFinishLaunching 下,我有:

[self.navigationController setToolbarHidden:NO];

在子视图中,在 viewDidLoad 下,我有:

[self.navigationController setToolbarHidden:YES animated:YES];

但是,在返回导航控制器时,工具栏仍保持隐藏状态。我已经尝试将此添加到 RootViewController 但没有成功。我无法弄清楚出了什么问题。

[self.navigationController setToolbarHidden:NO animated:YES];

1 个答案:

答案 0 :(得分:6)

subview中,您可以执行以下操作:

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

- (void)viewDidDisappear:(BOOL)animated
{
    [self.navigationController setNavigationBarHidden:NO animated:animated];
    [super viewWillDisappear:animated];
}