简体   繁体   English

如何使状态栏不透明(故事板)

[英]How to make statusbar not transparent (storyboard)

I've got a pretty straightforward question and somehow I didn't find an answer on this site yet. 我有一个非常简单的问题,以某种方式,我还没有在该站点上找到答案。 I've got a view with a background a yellow color. 我有一个黄色背景的视图。 I'm displaying content in the view and in order for the statusbar to not conflict with the content, I want the background to be non-transparent and preferably set to specific color. 我在视图中显示内容,为了使状态栏不与内容冲突,我希望背景是非透明的,最好设置为特定的颜色。

How do I do this with storyboards? 如何使用情节提要板执行此操作?

The only way I see is to add a 20 height view aligned to the top of the view to act as a status bar background. 我看到的唯一方法是将20高度视图添加到视图顶部,以用作状态栏背景。

20 is the current size of the status bar but it's better if u get it programatically. 状态栏的当前大小为20,但最好以编程方式获取。

[UIApplication sharedApplication].statusBarFrame.size.height

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM