在我的应用程序中,我有一个带有异步数据加载的UITableView:当加载视图控制器时,我会显示一个模态活动旋转器并启动HTTP。完成后,我将隐藏旋转器并在我的表视图上执行reloadData()。我还将response?.count ?? 0作为许多行返回,以确保当数据尚未准备好时,列表最初是空的。
这就像一种魅力,但我对VoiceOver有一个问题:当打开视图控制器时,VoiceOver会进入表并说“空列表”。当加载数据时,它会转到表的最后一个元素。
这种行为并不是最优的:我希望VoiceOver在表为空时不要对焦点(因为加载时已经有声音了,所以它不需要聚焦模态旋转器),然后在加载时转到第一个元素。
我该怎么做?
发布于 2017-06-23 21:17:55
您希望将加载覆盖屏幕设置为模态视图。模态意味着视图背后的事物是不可操作的(或者是VoiceOver无法聚焦的)。
//Instantiate a view controller with your loading spinner.
_modalDialogViewController = [[UIStoryboard storyboardWithName:@"ModalDialog" bundle:[NSBundle mainBundle]]
instantiateViewControllerWithIdentifier:@"AccessibleSpinnerModal"];
//Make this view controller modal, meaning only things on this screen will be actionable/focusable.
_modalDialogViewController.modalPresentationStyle = UIModalPresentationOverCurrentContext;然后,您还可能需要在这些样式中使用可访问性通知。
//Announce that content is loading directly
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, "Stuff is laoding");或
//Shift focus to the view in your modal that is sharing the status of the loading content.
UIAccessibilityPostNotification(UIAccessibilityLayoutChanged, spinnerView);这将导致焦点移至该视图。
https://stackoverflow.com/questions/44694728
复制相似问题