如何使带有大标题 VoiceOver 的 UITableView 兼容?

人气:414 发布:2022-10-16 标签: ios accessibility uitableview uikit voiceover

问题描述

我的应用程序有一个带有大的空白 tableHeaderView 的表格视图,允许将可见单元格完全滚动到窗口之外(到底部).所以 {0,0} 的 contentOffset 意味着,内容被滚动到窗口之外.初始 contentOffset 是 {0,{height of tableView}}.

My app has a table view with a large, blank tableHeaderView allowing to scroll the visible cells completely out of the window (to the bottom). So a contentOffset of {0,0} means, the content is scrolled out of the window. The initial contentOffset is {0,{height of tableView}}.

这一切正常,但我在为其启用可访问性时遇到了难题.

This all works fine but I'm having a hard problem to enable accessibility for it.

用户逐步浏览元素,从导航栏及其栏按钮开始.只要她再次滑动以激活表格视图的第一个单元格,表格视图就会自动滚动到 {0,0}.但是,由于第一个单元格在此 contentOffset 处不可见,因此无法将焦点放在它上面,而是将焦点放在最后一个选定的元素上.

The user steps through the elements, starting with the navigation bar and its bar buttons. As soon as she swipes again to activate the first cell of the table view, the table view automatically scrolls to {0,0}. However, since the first cell isn't visible at this contentOffset, it fails to focus on it and keeps the focus on the last selected element.

我可以以某种方式阻止这种情况或手动控制 VO 模式下的 contentOffset 吗?

Can I somehow prevent this or control the contentOffset in VO mode manually?

我创建了一个演示项目来展示我的问题.

I created a demo project showing my problem.

推荐答案

如果空标头中没有可访问的内容,请考虑在加载时以编程方式设置内容偏移,以防 UIAccessibilityIsVoiceOverRunning().您还需要监视 UIAccessibilityVoiceOverStatusChanged 并执行相同的操作.

If there is no accessible content in the empty header, consider setting the content offset programmatically upon load in the event that UIAccessibilityIsVoiceOverRunning(). You will also want to monitor for UIAccessibilityVoiceOverStatusChanged and do the same.

833