我想在关闭按钮时解除导航栏消失或在关闭屏幕时隐藏导航栏。
以下是代码:
- (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" 时,我会在界面中的所有其他屏幕上看到导航栏。换句话说,导航栏在所有其他屏幕中重叠(带到前面)。我为所有屏幕使用故事板。我认为必须在代码中进行更改。
请咨询