菜鸟教程小白 发表于 2022-12-11 18:20:09

ios - Swift - UITableViewCell 可访问性 (VoiceOver)


                                            <p><p> Storyboard中我的 TableViewCell 中的层次结构如下:</p>

<p>当我激活画外音时,它不是按 Storyboard中的顺序读取标签,而是按混合顺序读取标签。 </p>

<pre><code>-&gt;TableViewCell
---&gt;Label1
---&gt;Label2
---&gt;Label3
---&gt;Button
---&gt;Label4
</code></pre>

<p>有没有办法改变 tableviewcell 的画外音层次?</p>

<p>编辑:我在 <code>cellforrowat</code> 中尝试过这个,但没有任何改变。</p>

<pre><code>cell.accessibilityElements =
</code></pre>

<p>编辑 2:设置 <code>isAccessibilityElement = false</code> 使我的 accessibilityElements 订单工作。但是画外音的单元格选择现在不起作用。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>您不能同时拥有父 View<em>(您的表格 View 单元格)</em> 及其 subview<em>(label1, button...)</em>,它们是 <a href="http://a11y-guidelines.orange.com/mobile_EN/dev-ios.html#hide-elements-from-accessibility" rel="noreferrer noopener nofollow">both accessible</a>使用 VoiceOver:可以选择您的单元格或其内容。</p>

<p>不要选择单元格内的每个元素,而是在选择单元格时发出标签和<a href="http://a11y-guidelines.orange.com/mobile_EN/dev-ios.html#custom-actions" rel="noreferrer noopener nofollow">add custom actions</a>如果里面有按钮。</p>

<p>这是改善表格 View 单元格用户体验的最佳方式:具有可能操作的独特选择。</p>

<p> <a href="https://stackoverflow.com/a/55691540/3825084" rel="noreferrer noopener nofollow">This answer</a>可能对您的实现有所帮助。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - Swift - UITableViewCell 可访问性 (VoiceOver),我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/45225513/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/45225513/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - Swift - UITableViewCell 可访问性 (VoiceOver)