如何避免 iOS 蓝色位置导航栏弄乱我的状态栏? [英] How To Avoid iOS Blue Location NavigationBar Messing Up My StatusBar?

查看:38
本文介绍了如何避免 iOS 蓝色位置导航栏弄乱我的状态栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS 有一个功能(我同时使用 iOS 10 和 11)当您使用基于位置的应用程序(例如 Waze)并将该应用程序置于后台时,将会出现一个带有蓝色的蓝色导航栏状态栏背景说 Waze 当前正在使用您的位置.然后打开你自己的项目并关闭 Waze,这就会发生.

iOS has a feature that (I'm using both iOS 10 and 11) when you use a location-based app, say Waze, and you put that app on the background, there will be a blue navigation bar with a blue status bar background saying that Waze is currently using your location. Then open up your own project and close the Waze, this will happen.

知道如何解决这个问题吗?我猜测 AppDelegate 中有一些配置.在使您的项目处于活动状态时要设置的东西.我在我的另一个项目中尝试了相同的步骤,但我不知道为什么另一个项目处理得更好一点.另一个项目有一个可读的状态栏,但背景颜色不同,仍然很混乱,但比照片中的这个项目要好.

Any idea how to fix this one? I'm guessing some configuration in the AppDelegate. Something to setup upon making your project active. I've tried the same steps in my other project and I have no idea why does that other project handle it a little better. The other project has a readable status bar but different background color, still quite a mess but better than in this project in the photo.

推荐答案

这就是你的应用应该如何工作:

This is how your app should work:

  • 状态栏是透明的.

  • The status bar is transparent.

你的视图控制器的主视图应该低于状态栏;它应该是全屏的.

Your view controller's main view should underlap the status bar; it should be fullscreen.

您的视图应该使用自动布局来响应顶部栏大小的变化(它们应该固定到顶部布局指南,或者在 iOS 11 中固定到安全区域的顶部).

Your views should use autolayout to respond to changes in the size of the top bars (they should be pinned to the top layout guide or, in iOS 11, the top of the safe area).

您没有正确执行此操作,因此当状态栏大小因位置管理器栏而更改时,您的应用无法正常运行.您可能在来电时遇到了同样的问题.您可以通过选择切换通话状态栏在模拟器中轻松进行测试.

You are not doing that correctly, so your app does not behave correctly when the status bar size changes due to the location manager bar. You probably have the same problem with phone calls coming in. You can easily test in the Simulator by choosing Toggle In-Call Status Bar.

这篇关于如何避免 iOS 蓝色位置导航栏弄乱我的状态栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆