ios - 带有画外音的 UITextView

标签 ios ios8 uitextview accessibility

这是我创建 UITextView 的非常简单的代码。

UITextView *textView = [[UITextView alloc] initWithFrame:self.view.bounds];
textView.editable = NO;
textView.text = @"Using iOS 3.0 and later, VoiceOver is available to help users with visual impairments use their iOS-based devices. The UI Accessibility programming interface, introduced in iOS 3.0, helps developers make their applications accessible to VoiceOver users. Briefly, VoiceOver describes an application’s user interface and helps users navigate through the application’s views and controls, using speech and sound. Users familiar with VoiceOver in Mac OS X can leverage their experience to help them quickly come up to speed using VoiceOver on their devices.";
[self.view addSubview:textView];

鉴于我不可能在这里做错任何事,我只是想知道这是预期的行为还是可能有人也遇到过的错误:

启用画外音后,我希望整个 TextView 在点击时“突出显示”,然后将其 accessibilityLabel 读给用户,在他们双击后,整个 text view 要读取的文本。

但是发生的事情是 TextView 的一小部分被突出显示(通常是 2 行),accessibilityLabel 没有被读取,但是第一个“突出显示”的行和第一个字母(!)而是读取第二行的内容,并且只有在用户双击后才会读取整个文本。

enter image description here

尤其是阅读第二个突出显示的行中的第一个字母时,我感到很困惑。另外 accessibilityLabel 不应该总是在开始时阅读吗? 这对我来说似乎是个大问题,但 Apple 一直非常关注可访问性,所以我怀疑是否应该报告它,可能就是这样的意思。

另一个问题:是否有一种方法可以在启用画外音时实现以下行为(无需转租 UITextView):用户点击 UITextView -> accessibilityLabel 和整个文本都被阅读了吗?

最佳答案

如果其他人有这个问题,这里是答案:

textView.accessibilityTraits = UIAccessibilityTraitStaticText;

关于ios - 带有画外音的 UITextView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26204842/

相关文章:

xcode - 比较 iOS 8 中的 ImageView 不起作用

objective-c - UITextView beginningOfDocument 返回 nil

ios - 检测换行符在 UI​​TextView 中开始的时刻

ios - 如何在 iCloud Drive 上生成图像的缩略图?

ios - 为什么 XCTest 在 UITableViewCell 中公开一个随机的 otherElement? (并表现出其他不一致之处)

ios - 当我设置约束时,为什么我的 UITableView 将自身报告为 600x600,或者 Storyboard 中的内容?

ios - 如何从 iOS 键盘扩展中检测到通过在 iMessage 中点击 "Send"等操作清除了文本字段?

swift - 如何在 Swift 中选择具有 NSRange 的 textView 中的文本?

objective-c - UILabel 中数值的对齐

ios - 第一次音频启动延迟 - ios Swift