Ios 状态栏颜色与导航栏不匹配
我现在有一个视图控制器。我希望状态栏颜色与导航栏颜色匹配 我已将UIViewControllerBasedStatusBarAppearance设置为“是”,因为我不希望在整个应用程序中进行此更改 我正在设置self.navigationController.navigationBar.barTintColor,但这只是更改导航栏的颜色。状态栏保持较浅的颜色 我已经尝试过setNeedsStatusBarAppearanceUpdate和preferredStatusBarStyle的各种组合,但都没有效果 视图控制器按如下方式启动:Ios 状态栏颜色与导航栏不匹配,ios,statusbar,Ios,Statusbar,我现在有一个视图控制器。我希望状态栏颜色与导航栏颜色匹配 我已将UIViewControllerBasedStatusBarAppearance设置为“是”,因为我不希望在整个应用程序中进行此更改 我正在设置self.navigationController.navigationBar.barTintColor,但这只是更改导航栏的颜色。状态栏保持较浅的颜色 我已经尝试过setNeedsStatusBarAppearanceUpdate和preferredStatusBarStyle的各种组合,
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:searchController];
navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:navigationController animated:YES completion:nil];
我的步骤如下,检查哪里出了问题:
- (IBAction)clickAction:(UIButton *)sender {
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ViewController2 *searchController = [sb instantiateViewControllerWithIdentifier:@"ViewController2"];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:searchController];
navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:navigationController animated:YES completion:nil];
}
如何创建导航栏?视图控制器嵌入在导航控制器中。问题中添加了代码。你的意思是:是的,这就是我希望它看起来的样子。好的,我确信问题是由你的错误步骤造成的。我将给出我的步骤。我发现了问题。有人将此添加到viewDidLoad中的一个方法中:self.navigationController.navigationBar.clipsToBounds=true;