Search code examples
iosswiftstatusbarlandscape

Status bar left white rectangle after rotate in landscape mode


I have VC with UIView with hidden navigation bar with

self.navigationController?.setNavigationBarHidden(true, animated: animated)

At top VC have my view with constraint View.top = SafeArea.Top

When in portrait mode - all is ok. But when rotate to landscape mode status bar left in VC like white rectangle.

I don't need status bar in landscape. How to remove it? And why statusbar left this rectagle?


Solution

  • SORRY! I find the reason. This is a custom view, that used for coloring statusbar.

    Example of adding this view.

    let statusBarView = UIView(frame: UIApplication.shared.statusBarFrame)
    let statusBarColor = UIColor(r: 240, g: 243, b: 245)
    statusBarView.backgroundColor = statusBarColor
    view.addSubview(statusBarView)
    

    Thank you everyone!