简体   繁体   English

如何停止UISegmentedControl的VoiceOver声明?

[英]How to stop VoiceOver announcement for UISegmentedControl?

My app has a UISegmentedControl that contains two buttons. 我的应用程序有一个UISegmentedControl包含两个按钮。 I'm able to access each button's accessibility fields; 我可以访问每个按钮的辅助功能字段; the problem I'm having is that for subviews of a segmented control, VoiceOver reads out the subview's accessibility properties and then announces the view's position within the segmented control, so the VoiceOver announcement for the first button is "Previous message. Button. One of two." 我遇到的问题是,对于分段控件的子视图,VoiceOver会读出子视图的辅助功能,然后在分段控件中宣布视图的位置,因此第一个按钮的VoiceOver声明是“上一条消息。按钮。”二。” and for the second button it's "Next message. Button. Two of two." 对于第二个按钮,它是“下一条消息。按钮。两个中的两个。”

How can I prevent the last part of these announcements (the "one of two" and "two of two" parts), which have no real meaning to VoiceOver users? 如何阻止这些公告的最后部分(“两个”和“两个”中的两个部分),这对VoiceOver用户没有实际意义?

You can set accessibilityTraits property of UISegmentedControl 's subviews to UIAccessibilityTraitNone to disable "Tab X of Y" part of the VoiceOver: 您可以将UISegmentedControl的子视图的accessibilityTraits属性设置为UIAccessibilityTraitNone以禁用VoiceOver的“Tab X of Y”部分:

    for (UIView *thisView in self.segmentedControl.subviews) {
        [thisView setAccessibilityTraits:UIAccessibilityTraitNone];
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM