How to show double height green statusbar (In-Call) in foreground app on device?

后端 未结 2 1346
感动是毒
感动是毒 2021-01-04 20:24

There\'s a lot of questions here asking for displaying a red recording bar while in background. It\'s totally clear I should use AVAudioSession category A

2条回答
  •  臣服心动
    2021-01-04 21:11

    Roman Ermolov's answer explained that some apps use their own UIView for this functionality, but does not explain how. The way I see it, you have a few options.

    If you want to lay the view on top of (and covering) the current view controller, you could create a UIView with a UILabel or your own UIWindow and add that as a subview of your applications' keyWindow.

    To have the view stick on top without covering the contents of the view controller, you could take the same approach as above and manually resize the application window or window's root view controller when you add the call bar subview. Alternatively, you could create a UIViewController base class which contains this call bar subview and an outlet for the view's height constraint. The default value of this constraint should be zero. Then, when a call is placed, change the height constraint to your desired call back height. This constraint approach might work on the application's UIWindow as well, but I'm not too familiar with using constraints on an application's window.

提交回复
热议问题