我有一个文本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/