gpt4 book ai didi

View 转换时 iOS 7 UINavigationBar 未隐藏

转载 作者:可可西里 更新时间:2023-11-01 05:41:18 26 4
gpt4 key购买 nike

我有像 vc1 -> vc2 -> vc1 这样的 View Controller 转换。我需要将 UINavigationBar 隐藏在 vc1 中,并在 vc2 中显示。

我做了以下事情:

- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];

self.navigationController.navigationBarHidden = YES;
}

- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];

self.navigationController.navigationBarHidden = NO;
}

在 iOS6 中,它工作正常。但是在iOS7中,当我从vc1回到vc2时,导航栏并没有被隐藏,而是向上移动到状态栏后面,过渡动画结束后导航栏被隐藏了。

我怎样才能真正隐藏导航栏?

最佳答案

像这样尝试:

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

-(void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];

[self.navigationController setNavigationBarHidden:NO];
}

或者这样尝试:

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

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

关于 View 转换时 iOS 7 UINavigationBar 未隐藏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19697770/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com