gpt4 book ai didi

objective-c - 为什么我的导航栏在我的状态栏下面?

转载 作者:太空狗 更新时间:2023-10-30 03:31:19 25 4
gpt4 key购买 nike

http://www.irovr.com/stackOverflow/overlap.png

- (void)viewDidLoad {
[super viewDidLoad];
[self setWantsFullScreenLayout:YES];
[mainScrollView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onMainScrollTap:)]];
}

- (void)onMainScrollTap:(id)sender {
if(self.navigationController.navigationBar.hidden){
[self.navigationController setNavigationBarHidden:NO animated:YES];
[self.navigationController setToolbarHidden:NO animated:NO];
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
}else{
[self.navigationController setNavigationBarHidden:YES animated:YES];
[self.navigationController setToolbarHidden:YES animated:YES];
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
}
}

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

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];

self.navigationController.navigationBar.translucent = YES;
self.navigationController.toolbar.translucent = YES;
}

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

- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
self.navigationController.navigationBar.translucent = NO;
self.navigationController.toolbar.translucent = NO;
[self.navigationController setNavigationBarHidden:NO animated:YES];
[self.navigationController setToolbarHidden:YES animated:NO];
}

最佳答案

好像是同时隐藏状态栏和导航栏导致了这个问题。我能够通过使用 performSelector:withObject:afterDelay 隐藏/显示导航栏来解决它,即使延迟为 0

关于objective-c - 为什么我的导航栏在我的状态栏下面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3222256/

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