当应用程序处于后台时,状态栏下方的iOS文本 [英] IOS Text below Status Bar while app is in Background
问题描述
我正在尝试弄清如何在后台运行应用程序的情况下,在statusbar
下面的文本中实现横幅之类的通知.
I'm trying to figure out how to implement a banner like notification with text below the statusbar
while an app is in the background.
类似于Runkeeper,它处于活动状态且应用程序处于后台时
Much like Runkeeper, while active and app is in background:
是横幅吗?我所能找到的就是当应用程序处于前台时的广告横幅.
Is it a Banner? All I can find for that is banners for ads while the app is in the foreground.
我是否需要自定义StatusBar
并为StatusBar
添加额外的视图并显示自定义文本?
Do I need to customize the StatusBar
and add an extra view for the StatusBar
with a custom text to appear?
这是要连续显示的自定义UILocalNotification
吗?
Is it a customized UILocalNotification
to be continuously shown?
推荐答案
在以下情况下,iOS本身会显示此横幅:
This banner is displayed by iOS itself in the following situations:
- 后台应用程序正在跟踪您的位置(在
startUpdatingLocation
之后) - 后台应用正在使用您的麦克风
- 后台应用正在执行VOIP通话
- A background app is tracking your position (after a
startUpdatingLocation
) - A background app is using your microphone
- A background app is performing a VOIP call
横幅颜色随原因而变化.
只能通过使用相关的背景模式之一来强制iOS显示这些横幅.
The banner color changes with the reason.
There is no way to force iOS to display those banners but by using one of the relevant background modes.
这篇关于当应用程序处于后台时,状态栏下方的iOS文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!