Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone - make VoiceOver announce label text change

Is it possible using VoiceOver on the iPhone to announce the updated text on a label if it changes?

This would be analogous to a live-region in ARIA.

Thanks.

like image 590
Dave Avatar asked Apr 02 '11 00:04

Dave


1 Answers

You can make VoiceOver announce any text you like with:

UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, @"Your text");

If a label should announce its text as soon as it is updated, simply extend the UILabel and override the setText method.

The .h File:

@interface UIVoicedLabel : UILabel {

}

@end

And its implementation:

#import "UIVoicedLabel.h"

@implementation UIVoicedLabel

- (void) setText:(NSString *)text {
    // Set the text by calling the base class method.
    [super setText:text];
    // Announce the new text.
    UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, text);
}

@end

This worked perfectly for me :)

like image 140
Nemeova Naminski Avatar answered Oct 22 '22 08:10

Nemeova Naminski