OGeek|极客世界-中国程序员成长平台

标题: ios - 如何在 UITableView 上设置 VoiceOver 初始焦点 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 09:56
标题: ios - 如何在 UITableView 上设置 VoiceOver 初始焦点

在我们的 iOS 应用中,我们有一个带有 UINavigationController 的屏幕,右边的 BarButtonItems 中有三个 UIBarButtonItem,一个带有 UITableView subview 的 UIView 内容 View 。

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

我们已尝试调用 UIAccessibilityPostNotification(),但这仅在我们添加延迟时才有效,并且这看起来非常脆弱,并且会使用户感到困惑,因为焦点将从 UIBarButtonItem 开始然后跳转。



Best Answer-推荐答案


dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(0.75*Double(NSEC_PER_SEC))), dispatch_get_main_queue()) { () -> 无效 UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification,self.view) }

这可能有效。

关于ios - 如何在 UITableView 上设置 VoiceOver 初始焦点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33921537/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4