如果我设置 NavigationBarHidden = YES
,我无法设置 statusBackgroundcolor。
那么我该如何解决这个问题呢?
enter image description here
最佳答案
您可以采用大小为 (self.view.frame.size.width,20)
的自定义 View ,并可以放置在状态栏上。即在 (0,0) 原点。然后根据需要将状态栏背景颜色设置为该 View 的背景颜色。如果您使用的是自动布局,请为该 View 设置适当的约束。如果您正在使用自动布局,那么您对此自定义 View 的约束应该是 (top,leading,trailing and fixed height)
。
关于ios - 在 NavigationBarHidden 之后,StatusBar 太糟糕了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38495521/