Accessibility: Voice over read update label?

3.1k Views Asked by At

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 ?

2

There are 2 best solutions below

1
Justin On BEST ANSWER

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.
0
WalterBeiter On

Swift 5:

UIAccessibility.post(notification: .layoutChanged, argument: label)