'UILabel accessibilityAttributedLabel not working for "Spoken Content" and the Accessibility Inspector
I want to explicitly set the spoken language for one of my accessible UILabels. This is my example code:
let attributedString = NSMutableAttributedString(string: "This is English but will be read in German",
attributes: [.accessibilitySpeechLanguage : "de-DE"])
label.accessibilityAttributedLabel = attributedString
This works in the regular VoiceOver functionality. The voice actually reads the English text with a German accent, which is intended.
While this seems fine, the attributes that I set seem to be completely ignored in the Xcode Accessibility Inspector and the "Spoken Content" feature in iOS.
Can somebody help me to find out where this issue is coming from? Why is this not working with all the tools and is this documented somewhere?
Thanks for the help!
Solution 1:[1]
Override the property and return to true
override public var isAccessibilityElement: Bool { return true }
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | FBC |
