ios15从隐藏系统导航栏页面进入显示系统导航栏页面后,期望系统导航栏背景色为白色,但是导航栏背景变成黑色问题。
经过多次分析是因为底层大背景被设置了默认颜色引起,把它设置成对应白色就可以了:
self.navigationController.view.backgroundColor = [UIColor whiteColor];//设置系统导航栏及大背景颜色。
完整的上下文代码:
- (void)viewWillAppear:(BOOL)animated{[super viewWillAppear:animated];[self.navigationController setNavigationBarHidden:NO animated:YES];//显示系统导航栏self.navigationController.navigationBar.translucent = YES;self.navigationController.view.backgroundColor = [UIColor whiteColor];//设置系统导航栏及大背景颜色。// 开启返回手势if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {self.navigationController.interactivePopGestureRecognizer.enabled = YES;}//白色self.navigationController.navigationBar.barTintColor = [UIColor whiteColor];self.navigationController.view.backgroundColor = [UIColor whiteColor];}
ios15从隐藏系统导航栏页面进入显示系统导航栏页面后 期望系统导航栏背景色为白色 但是导航栏背景变成黑色问题