简体   繁体   English

Swift-TableViewCell可访问性(VoiceOver)

[英]Swift - TableViewCell Accessibility (VoiceOver)

Hierarchy in my TableViewCell in storyboard is like below: 故事板上的TableViewCell中的层次结构如下所示:

When I activated voiceover, it reads the labels not in the order in the storyboard but in a mixed order. 当我激活画外音时,它不是按故事板中的顺序而是按混合顺序读取标签。

->TableViewCell
--->Label1
--->Label2
--->Label3
--->Button
--->Label4

Is there a way to change the voiceover hierarchy for tableviewcell? 有没有办法改变tableviewcell的画外音层次?

Edit: I tried this in cellforrowat , but nothing changed. 编辑:我在cellforrowat尝试了此cellforrowat ,但没有任何更改。

cell.accessibilityElements = [Label1, Label2, Label3, Button, Label4]

Edit 2: Setting isAccessibilityElement = false makes my accessibilityElements order work. 编辑2:设置isAccessibilityElement = false使我的accessibilityElements订单工作。 But cell selection to voiceover is not working now. 但是,从单元格选择到画外音现在不起作用。

You cannot have simultaneously a parent view (your table view cell) and its child views (label1, button...) that are both accessible with VoiceOver: either your cell can be selected or its content. 您不能同时具有可以通过VoiceOver 访问的父视图(表视图单元格)及其子视图(标签1,按钮...) :可以选择单元格或其内容。

Instead of selecting each element inside your cell, vocalize the labels when your cell is selected and add custom actions if buttons are available inside. 不用选择单元格中的每个元素,而是在选择单元格时发出标签的声音,如果内部有可用按钮,则添加自定义操作

That's the best way to improve the user experience for your table view cell: one unique selection with possible actions. 这是改善表格视图单元的用户体验的最佳方法:一种唯一的选择,并可能采取的措施。

This answer may help for your implementation. 该答案可能对您的实施有所帮助。

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

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