1
votes

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?

2
Did you set left and right constraint too?Vahid
@Vahid Offcourse! Its all ok with constraints. But a part of my view under this rectangle.Andrii Kryvchykov
your image is not clear. in the landscape I see a profile image. where was that in the first image?! Please add full screen image.Vahid
@Vahid On first image storyboard screenshot of parent view, that contain my view with profile image. On second image screenshot from device screen. But still it does not matter. I find the problem: custom view fol coloring statusbar. Thank you for trying to help!Andrii Kryvchykov

2 Answers

0
votes

I have implemented the code according to your scenario it's working fine for me. I thinks this is problem with xcode/compiler. You can do:

  1. set the main view clipToBounds property to true.
  2. Hide navigation bar from storyboard: Select NavigationController, open identity inspector, untick the shows Navigation Bar option
0
votes

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!