如何为VoiceOver排队多个辅助功能通知? [英] How can I queue multiple accessibility notifications for VoiceOver?

查看:108
本文介绍了如何为VoiceOver排队多个辅助功能通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我通知系统以读出我的元素的方式:

This is how I'm notifying the system to read out my elements:

UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, cell)

问题是当我发送多个通知时,已经在读取的通知被打断了!我希望能够排队...

The problem is that when I send multiple notifications, the one that is already reading gets interrupted! I want to be able to queue it...

我在这里的另一个问题中发现我应该使用属性字符串:

I also found in another question here that I should use attributed string:

attributedString.addAttribute(NSAttributedStringKey(
    rawValue: UIAccessibilitySpeechAttributeQueueAnnouncement), 
    value: true, 
    range: range!.nsRange)

我在这里想念什么?

推荐答案

我在这里想念什么?

What am I missing here?

我进行了许多测试,以尝试理解使我发疯的行为.

I have made many tests to try and understand this behaviour that drove me crazy.

我的结论是,如果您在VoiceOver讲{标签/提示/值}的同时发送通知,则不会考虑您的通知:系统需要表达属性时,可能会有一种抢占方式的重点元素.

My conclusion is that if you send a notification while VoiceOver is speaking a {label / hint / value}, your notification won't be taken into account : there may be a kind of preemption when the system needs to vocalize an attribute of a focused element.

只有在发声结束时,您才能发布任意数量的通知,以便根据需要对它们进行很好的分析和解释.

That's only at the end of the vocalization that you can post as many notifications as you want to be well analyzed and interpreted as you wish.

UIAccessibilitySpeechAttributeQueueAnnouncement键仅在系统不需要接管时用于您自己的通知.

The UIAccessibilitySpeechAttributeQueueAnnouncement key is only useful with your own notifications when the system doesn't need to take over.

例如,如果您发送许多通知,并且用户轻弹以关注一个新元素,则系统会在发出声音的元素属性后立即删除未发出声音的通知.

If you send many notifications and that the user flicks to focus a new element for instance, the notifications that weren't vocalized will be removed as soon as the system vocalizes the element's attributes.

在这种情况下,如果捕获到UIAccessibilityAnnouncementDidFinish事件,则对于最后一个发声的通知(UIAccessibilityAnnouncementKeyStringValue),使用UIAccessibilityAnnouncementKeyWasSuccessful键将具有错误的值...以下所有内容都将被忽略,而没有观察者给出的信息.

In that case, if you catch the UIAccessibilityAnnouncementDidFinish event, you will have a false value with the UIAccessibilityAnnouncementKeyWasSuccessful key for the last vocalized notification (UIAccessibilityAnnouncementKeyStringValue)... all the following ones will be ignored with no info given by the observer.

结论:当出现新的焦点元素或屏幕/布局更改的通知时,VoiceOver不会考虑任何个人通知.

如何为VoiceOver排队多个辅助功能通知?

How can I queue multiple accessibility notifications for VoiceOver?

根据上面介绍的内容,我建议建立一种重试机制,该机制仍会在未完全收到通知的情况下(x次)发送通知(x次)例如,在y秒后.
这可能是一个棘手的方法,可以更加确定地确保完美无误地接收到了通知.

According to what's exposed above, I suggest to set up a kind of retry mechanism that would still send your notifications (x times) while they're not perfectly received after y seconds for instance.
That could be a tricky way to be more certain that the notifications are flawlessly received.

这篇关于如何为VoiceOver排队多个辅助功能通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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