TableViewCell中的CollectionView的iOS辅助功能 [英] iOS Accessibility for CollectionView in a TableViewCell

查看:172
本文介绍了TableViewCell中的CollectionView的iOS辅助功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在研究项目的可访问性,这里是放入自定义UITableViewCell的UICollectionView。这个CollectionView有几十个单元格排列成多行而不是一行。

I'm currently working on the accessibility of our project, and here is UICollectionView that is put into a custom UITableViewCell. This CollectionView has tens of cells that are arranged in multiply rows rather than one row.

它引发了一个问题,当你打开voiceOver并在collectionViewCells之间移动焦点时向左或向右滑动,系统认为你在tableViewCells之间滑动,因为collectionView在tableView中,而tableView的contentOffSet将根据tableViewCell大小而不是collectionViewCell大小进行更改。

It raises an issue that when you have voiceOver on and move the focus between the collectionViewCells by swiping left or right, the system thought you are swiping between tableViewCells, since collectionView is in the tableView, and the contentOffSet of the tableView will be changed according to the tableViewCell size, instead of the collectionViewCell size.

CollectionView已经放在tableView中,我认为我不能改变它。所以只是想知道以前是否有人遇到过此案例并且仍然可以使collectionView正常访问?

CollectionView is already put in the the tableView and I don't think I can change this. So just wondering has anyone met this case before and is there anyway to make the collectionView accessible as normal?

推荐答案

这是一个已知的在tableView中嵌套collectionView时,Apple的SDK中的错误(抱歉,我没有错误报告参考)。经过一些实验,我能够通过使用UIView作为我的collectionView的包装来解决它,然后将它添加到我的UITableViewCell的.contentView

This is a known bug in Apple's SDK (sorry, I don't have a bug report reference) when nesting a collectionView inside a tableView. After some experimentation, I was able to work around it by using a UIView as a wrapper for my collectionView before adding it to my UITableViewCell's .contentView

    UIView *wrapperView = [[UIView alloc] initWithFrame:cell.contentView.bounds];
    wrapperView.accessibilityElements = @[collectionView];
    [cell.contentView addSubview:wrapperView];
    [wrapperView addSubview:collectionView];

这篇关于TableViewCell中的CollectionView的iOS辅助功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆