TableViewCell 中 CollectionView 的 iOS 辅助功能

标签 ios uicollectionview tableview accessibility voiceover

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

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

CollectionView 已经放在 tableView 中,我认为我无法更改它。所以只是想知道以前是否有人遇到过这种情况,无论如何都可以使 collectionView 正常访问?

最佳答案

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

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

关于TableViewCell 中 CollectionView 的 iOS 辅助功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35638357/

相关文章:

ios - UICollectionView - 在其他单元格中重复的 subview 实例

ios - 如何强制 UICollectionView 滚动到特定行并加载该行的单元格,同时隐藏 Collection View ?

swift - swift 中的自定义属性字符串操作

swift - 将 UITableView 约束为 InputAccessory

ios - 按特定顺序排列单元格

ios - UITableView - UITableViewCell.Style .subtitle - 如何使 UIImageView 圆形? - swift 5

ios - UITableViewAutomaticDimension 不适用于自定义 XIB 单元

ios - 另一个 Xcode 配置文件查询

iphone - 用于 iOS 或 objective-c 端口的 libphonenumber

ios - prepareForReuse 无法与 imageView 一起正常工作