gpt4 book ai didi

ios - 如何在信号丢失时播放画外音通知(即没有用户交互)?

转载 作者:可可西里 更新时间:2023-11-01 00:39:20 25 4
gpt4 key购买 nike

我构建了一个简单的音频流应用程序,如下所示:

enter image description here

当我失去音频流连接时,我的应用程序将此屏幕覆盖在 UI 之上:

enter image description here

我想让盲人或视力不佳的人也可以使用该应用程序,因此我希望画外音在信号丢失和覆盖屏幕出现时说出“信号丢失”和“正在重新连接”。这一切都是在没有任何用户交互的情况下发生的(类似于屏幕超时和 VO 说“屏幕变暗”时发生的情况)。 VO 也可以在重新连接时说“信号恢复”,但这不是绝对必要的。

更棘手的是,当“信号丢失”屏幕出现时,用户应该无法操作下方主 UI 中的任何其他字段。

我该如何实现?

在此先感谢您的帮助!

最佳答案

您可以使用 UIAccessibilityPostNotification 制作一个“通知”,这将导致它大声朗读(仅当启用 VoiceOver 时):

UIAccessibilityPostNotification(
UIAccessibilityAnnouncementNotification,
"Signal Lost" as NSString
)

documentation for UIAccessibilityAnnouncementNotification解释 NSString 参数以及何时适合使用:

This notification includes a parameter, which is an NSString object that contains the announcement. An assistive technology outputs the announcement string contained in the parameter.

Use this notification to provide accessibility information about events that do not update the application user interface (UI), or that update the UI only briefly.

我的建议是谨慎使用公告,但我要说的是,在没有任何用户交互的情况下发生的事件通常——但并非总是——很好地使用它们。

关于ios - 如何在信号丢失时播放画外音通知(即没有用户交互)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48998317/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com