ios - 如何让 Voiceover 拼出单词中的每个字母?

标签 ios swift voiceover uiaccessibility

我有一个文本CPN34THX,它应该被画外音读成C N 3 4 T H X 是否有任何属性可以设置为 UIAccessibility 以便可以逐字符读取?

最佳答案

您可以尝试使用 NSAttributedString.Key.accessibilitySpeechSpellOut 使 VoiceOver 分别读出每个字母。

来自 UIAccessibilityConstants.h:

// Use an NSNumber with a YES or NO value to specify whether each letter in the string should be spoken separately.
    @available(iOS 13.0, *)
    public static let accessibilitySpeechSpellOut: NSAttributedString.Key

请注意,此功能仅适用于 iOS 13 及更高版本。

一个例子:

let string = "CPN34THX"
let attributedLabel = NSMutableAttributedString(string: string,
                                                attributes:[.accessibilitySpeechSpellOut: true])
yourAccessibleView.accessibilityAttributedLabel =  attributedLabel

关于ios - 如何让 Voiceover 拼出单词中的每个字母?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58063598/

相关文章:

ios - 适用于 iOS 的 Quickblox : how do I extract locations only in 100 km area?

iphone - 保持背景的滑动菜单(Xcode 4.3)

ios - 我可以影响 VoiceOver 转子中出现的内容吗?

ios - Voiceover 如何决定 UITableView 关注哪个单元格?

c++ - mac语音合成管理器,创建语音 channel 时,返回参数错误

iOS 打开画外音时读取 tabeviewcell 中的所有元素

ios - 在 SwiftyCharts 中显示 JSON 多色

objective-c - 解决涉及枚举的 Swift.h 和 Bridging-Header.h 循环引用

Swift Mapbox 自定义用户位置注释( fatal error )

ios - 如何通过 iOS 应用程序中的 UIPickerView 实现 View 之间的转换?