1.在info.plist中添加View controller-based status bar appearance,值为NO
2.在设置状态栏的地方添加代码
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
透明: 导航栏本身是透明的,但是控制器添加视图会有20的偏移量 设置控制器的 self.automaticallyAdjustsScrollViewInsets = YES;就会从顶部显示 如果要导航栏和状态栏都全透明的话 self.navigationController.navigationBar.translucent = YES; [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; self.navigationController.navigationBar.shadowImage = [UIImage new];