简体   繁体   中英

Accessibility (VoiceOver) on NSAttributedString

I have a block of text in a UITextView built using NSAttributedString . I require VoiceOver to say something extra when certain portions of the text is touched.

Is it possible to add accessibility attributes to NSAttributedString ?

Speech attributes for attributed strings can be used in order to customize the way to vocalize the label , value and hint accessibility properties.

Watch the WWDC 2017 : What's New in Accessibility video on Apple's site whose content is perfectly summarized here .

Take a look at the Attributed Accessibility Properties section where an example is provided and well explained.

I think one solution to this would be a custom subclass of UITextView . Then you can return an array of UIAccessibilityCustomAction in an override of accessibilityCustomActions . These objects not only describe the actions taken by the text view, but they also allow VoiceOver to execute them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM