我的VC和UIView带有隐藏的导航栏,
self.navigationController?.setNavigationBarHidden(true, animated: animated)
在顶级VC中,我的视图受约束View.top = SafeArea.Top
在纵向模式下-一切正常。但是当旋转到横向模式状态栏时,VC会像白色矩形一样留在VC中。
我不需要横向显示状态栏。如何删除?为什么状态栏会留下这个标签?
答案 0 :(得分:0)
我已经根据您的情况实现了代码,对我来说很好。我认为这是xcode / compiler的问题。您可以这样做:
答案 1 :(得分:0)
抱歉! 我找到原因了。 这是一个自定义视图,用于为状态栏着色。
添加此视图的示例。
let statusBarView = UIView(frame: UIApplication.shared.statusBarFrame)
let statusBarColor = UIColor(r: 240, g: 243, b: 245)
statusBarView.backgroundColor = statusBarColor
view.addSubview(statusBarView)
谢谢大家!