skip to Main Content

I’ve configured app to support Notch Screen devices Running my App in the iPhone X Simulator.

the App is working fine in Normal views but does not use the full screen space if I have NAVIGATION CONTROLLERS

a strange Transparent Black Shade is appearing over the Navigation bar

Does anybody help me on this what is happening here and how to resolve this? I can’t find any new settings in Interface Builder.

enter image description here

2

Answers


  1. Try to set status bar background color with the same color of navigation controller, add this extension:

    extension UINavigationController {
    
    func setStatusBar(backgroundColor: UIColor) {
        let statusBarFrame: CGRect
        if #available(iOS 13.0, *) {
            statusBarFrame = view.window?.windowScene?.statusBarManager?.statusBarFrame ?? CGRect.zero
        } else {
            statusBarFrame = UIApplication.shared.statusBarFrame
        }
        let statusBarView = UIView(frame: statusBarFrame)
        statusBarView.backgroundColor = backgroundColor
        view.addSubview(statusBarView)
      }
    }
    

    Now in viewDidLoad call:

    navigationController?.setStatusBar(backgroundColor: .yourColor)
    
    Login or Signup to reply.
  2. HI Please add the below code in Appdelegate did finish launch

    if (@available(iOS 13.0, *)) {
    
            UIView *statusBar = [[UIView alloc]initWithFrame:[UIApplication sharedApplication].keyWindow.windowScene.statusBarManager.statusBarFrame];
    
            if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {
    
                statusBar.backgroundColor = [UIColor whiteColor];
    
            }
    
            [[UIApplication sharedApplication].keyWindow addSubview:statusBar];
    
    
    
        } else {
            UIView *statusBar = [[UIView alloc]initWithFrame:[UIApplication sharedApplication].keyWindow.frame];
    
            if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {
    
                statusBar.backgroundColor = [UIColor whiteColor];
    
            }
    
        }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search