Search code examples
swiftswift3accessibilityvoiceoveruiaccessibility-notification

Accessibility: Voice over read update label?


How to force voice over in Accessibility read my updated label

For example,

var label.text = 1

Then after 2 sec I update label to 2

label.text = 2

But the voice over not interact with 2

any suggest ?


Solution

  • If the question you're asking is, "How do I alert the user to a change in content," you can choose among three solutions.

    1. Post UIAccessibilityNotification(UIAccessibilityLayoutChangedNotification, label) to notify the system that the content has changed and force focus to the label.
    2. Post UIAccessibilityNotification(UIAccessibilityAnnouncementNotification, "Your announcement") to request that the system communicate the string to the user.
    3. Assign the UIAccessibilityTraitUpdatesFrequently trait to your label. The system will periodically announce changes to the content.