菜鸟教程小白 发表于 2022-12-12 09:56:15

ios - 如何在 UITableView 上设置 VoiceOver 初始焦点


                                            <p><p>在我们的 iOS 应用中,我们有一个带有 UINavigationController 的屏幕,右边的 BarButtonItems 中有三个 UIBarButtonItem,一个带有 UITableViewsubview 的 UIView 内容 View 。</p>

<p>每次应用程序进入前台时,VoiceOver 都会将初始焦点放在最左侧的 UIBarButtonItem 上。我们希望将焦点放在 UITableView(初始启动)中最顶部的单元格上,或者在应用程序进入后台之前用户主动选择的单元格上。</p>

<p>我们已尝试调用 UIAccessibilityPostNotification(),但这仅在我们添加延迟时才有效,并且这看起来非常脆弱,并且会使用户感到困惑,因为焦点将从 UIBarButtonItem 开始然后跳转。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(0.75*Double(NSEC_PER_SEC))), dispatch_get_main_queue()) { () -> 无效
             UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification,self.view)
}</p>

<p>这可能有效。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 如何在 UITableView 上设置 VoiceOver 初始焦点,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/33921537/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/33921537/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 如何在 UITableView 上设置 VoiceOver 初始焦点