简体   繁体   English

iOS 是否可以有半亮半暗的状态栏

[英]iOS is it possible to have status bar that is half light and half dark

I have status bar where left part is on dark background and I have there light text content.我有状态栏,左侧部分位于深色背景上,并且有浅色文本内容。 But right part of status bar background is on the other hand white and I would like to have there black text.但另一方面,状态栏背景的右侧部分是白色的,我希望有黑色文本。

Is it possible to set different colours of status bar content in left and right half.是否可以在左右半部分设置不同颜色的状态栏内容。 In left I have dark menu and in right I have content on white background.在左边我有深色菜单,在右边我有白色背景的内容。

在此处输入图像描述

I found solution but I have Split View Controller and then I can override in preferredStatusBarStyle differently in Master and Detail view controller.我找到了解决方案,但我有拆分视图 Controller,然后我可以在主视图和详细视图 controller 中以不同的方式覆盖首选状态栏样式。 In general I think it will not be possible while having single view controller一般来说,我认为只有单视图 controller 是不可能的

you can do that by placing an image or view at the status bar level.您可以通过在状态栏级别放置图像或视图来做到这一点。 you can also take a container view and pin its top constraint to the safe area here is an example I just created using autolayout itself.您还可以获取容器视图并将其顶部约束固定到安全区域这是我刚刚使用自动布局本身创建的示例。 Xcode 用户界面示例

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

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