I am trying to provide an accessibility label for UIActivityIndicatorView (which is created programmatically in my view controllers viewDidLoad). I am setting the accessibility label as:
myIndicatorView.accessibilityLabel = @"Please wait, processing"
But when I run the application, the voice over always reads "in progress". I tried to debug on simulator using the accessibility inspector, but everytime the indicator view is in focus, it has the label as "in progress". I assume, "in progress" is default voice over text for activity indicators view, But I can not change this label. I am wondering if the activity indicator view's accessble label can never be changed. If somebody came across this issue and found a workaround, then please help me.
Smartphones and tablets have their own “voice” that reads out loud whatever is on the screen for you. This can be a notification, the name of the app you tap on, a website, the information of a caller or the content of your emails and text messages.
Turn VoiceOver on or offActivate Siri and say “Turn on VoiceOver” or “Turn off VoiceOver.” If you've set up Accessibility shortcut, triple-click the side button or Home button (depending on your iPhone model). Use Control Center. Go to Settings > Accessibility > VoiceOver, then turn the setting on or off.
While VoiceOver is not available directly in the Xcode simulator, it is possible to run VoiceOver from macOS to test your app. To do this, set keyboard focus on the simulator window then enable VoiceOver. From here you'll be able to use the Virtual Cursor to move between items on the screen.
It's not that you're not changing it. It's that, in the background, as the status of the progress indicator changes, iOS backend updates the label, to the appropriate status. This is overriding whatever you changed it to, because it is likely applying its own update after you change the status.
I would just leave this alone. "Please wait, processing" provides no additional information as compared to "In progress". And "In progress" is the way VoiceOver users will be accustomed to hearing an "In progress" state progress indicator announce. Changing this announcement is to a non-sighted user, what changing the image to a revolving Mickey Mouse head would be to sighted one.
If you MUST change this, what you want to do, is instead of setting the property, override the implementation of the property's getter method. To do this provide a custom implementation of UIActivityIndicatorView that does the following.
@interface MyActivityIndicator : UIActivityIndicatorView
@end
@implementation MYActivityIndicator
- (NSString*)accessibilityLabel {
if (self.isAnimating) {
return NSLocalizedString("ACTIVITY_INDICATOR_ACTIVE", nil);
} else {
return NSLocalizedString("ACTIVITY_INDICATOR_INACTIVE", nil);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With