我试图从 VoiceOver 中隐藏应用程序中的多个元素,以便屏幕阅读器不会大声朗读它们。在 iOS 上,我设置isAccessibilityElement
to NO
,但这对 OSX 没有影响。从 VoiceOver 隐藏元素的正确方法是什么?
例如,我在视图中包含一系列标签,如果由 VoiceOver 单独说出这些标签,则这些标签毫无意义。我想设置accessibilityLabel
在容器视图上描述嵌套在其中的所有标签。但如果我这样做,里面的标签仍然会由 VoiceOver 读出。
在 macOS 中,确实如此设置accessibilityElement
to NO
for NSButton
, NSTextField
and NSImageView
没有影响。那是因为这些是controls– 他们继承自NSControl
。为了让它工作controls,您必须对控件执行此操作cell.
在一个 Objective-C 项目中,我对几个 Cocoa 控件进行了子类化。例如,每当我希望 VoiceOver 跳过图像视图时,我都会在 Interface Builder 中将其自定义类设置为:
/*!
@brief Image view which will be skipped over by VoiceOver
@details Be careful that you *really* want the view to be skipped over by
VoiceOver, because its meaning is conveyed in a better, non-visual way,
elsewhere. Remember that not all VoiceOver users are completely blind.
*/
@interface SSYNoVoiceOverImageView : NSImageView {}
@end
@implementation SSYNoVoiceOverImageView
- (void)awakeFromNib {
self.cell.accessibilityElement = NO;
}
@end
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)