OPTION 1
You can listen when new elements are focused by observing UIAccessibilityElementFocusedNotification notifications.
[[NSNotificationCenter defaultCenter] addObserver:yourTTSManager selector:@selector(interruptTTSFunction:) name:UIAccessibilityElementFocusedNotification object:nil];
and interrupt your custom speech synthesis messages when they are received.
Pros: gives VoiceOver user a lot of control.
Cons: You donβt know when VoiceOver finished reading a recently focused control, so you cannot use this to interrupt and restart announcements.
OPTION 2
You can tell VoiceOver to pause and restart by posting
UIAccessibilityPostNotification(UIAccessibilityPauseAssistiveTechnologyNotification, nil);
before your announcement and
UIAccessibilityPostNotification(UIAccessibilityResumeAssistiveTechnologyNotification, nil);
after finishing.
Pros: Your ad will be fully read.
Cons: you take control of the hands of users when pausing VoiceOver.
Recommendations for
If your ads are short, pausing and resuming AT is not a terrible decision. Otherwise, I would recommend VoiceOver users to interrupt / cancel your ads by listening to UIAccessibilityElementFocusedNotification events and canceling any active announcements when they are received.
source share