开发者

Can I tell iOS when it's in VoiceOver mode to read aloud a specific UILabel's text when I change it?

开发者 https://www.devze.com 2023-04-04 08:57 出处:网络
I\'ve got a label that\'s going to change to say something silly like \"the sky is now blue\" and I\'d like to have VoiceOver read that new text aloud without a semi-blind user needing to press on the

I've got a label that's going to change to say something silly like "the sky is now blue" and I'd like to have VoiceOver read that new text aloud without a semi-blind user needing to press on the 开发者_StackOverflowlabel.

Is that possible however, to direct VoiceOver to read a specific item when & where I want?

Thanks.


See this answer: iPhone - make VoiceOver announce label text change

In short, you can tell iOS to speak text aloud when in voiceover mode by sending notifications, like:

UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, @"the sky is now blue");


I'm still trying to figure out how to "focus" on a particular UIAccessibilityElement (i.e. make it as if they had tapped it), but I think in your case you could use UIAccessibilityAnnouncementNotification to speak arbitrary text.

0

精彩评论

暂无评论...
验证码 换一张
取 消