gpt4 book ai didi

ios - setNavigationBarHidden :NO is appearing when dismissed

转载 作者:行者123 更新时间:2023-11-29 01:41:19 26 4
gpt4 key购买 nike

我想让导航栏在使用关闭按钮关闭时消失,或者在关闭屏幕时让导航栏隐藏。

代码如下:

- (void)viewDidLoad
{

[self.navigationController setNavigationBarHidden:FALSE ];

self.title=@"Cookie Policy";

NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"Cookie Policy" ofType:@"html"];
NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
[webView loadHTMLString:htmlString baseURL:nil];



UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0, 0, 20, 32);
button.titleLabel.font=[UIFont boldSystemFontOfSize:15];
[button setTitle:@"X" forState:UIControlStateNormal];
[button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
[button addTarget:self action:@selector(openView) forControlEvents:UIControlEventTouchUpInside];

UIBarButtonItem *barButton=[[UIBarButtonItem alloc] init];
[barButton setCustomView:button];
self.navigationItem.leftBarButtonItem=barButton;

}

当按下 setTitle:@"X" 时,我会在 UI 的所有其他屏幕上看到导航栏。换句话说,导航栏在所有其他屏幕中重叠(置于最前面)。我为所有屏幕使用 Storyboard。我认为必须在代码中进行更改。

请指教

最佳答案

我通过添加以下代码行解决了该问题:

    _nav.navigationBarHidden = YES;

不需要接触 Storyboard 中的任何内容。

关于ios - setNavigationBarHidden :NO is appearing when dismissed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32348840/

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