简体   繁体   English

UITableView 中的 CollectionView Cell 不会为 Voice Over 可访问性水平滚动

[英]CollectionView Cell inside UITableView is not scrolling horizontally for Voice Over accessibility

In my app, I have a screen where I need to support voice over accessibility.在我的应用程序中,我有一个屏幕,我需要在其中支持语音辅助功能。 The screen has a TableView and inside that a collectionView.屏幕有一个 TableView,里面有一个 collectionView。 When voice over is ON and when I try to single or three fingers swipe, the collectionView scroll is not working.当画外音打开并且当我尝试单指或三指滑动时,collectionView 滚动不起作用。 The accessibility focus is not moving to the next cell.可访问性焦点不会移动到下一个单元格。 Voice over is working fine only for visible cells in collectionView.旁白仅适用于 collectionView 中的可见单元格。

I tried by disabling accessibility for collectionView Cell and UITableViewCell but still, it didn't work.我尝试禁用 collectionView Cell 和 UITableViewCell 的可访问性,但仍然无效。

I want to make it work like in the AppStore, where we will have a similar kind of design.我想让它像在 AppStore 中一样工作,在那里我们会有类似的设计。

I am attaching screenshots of my screen and some codes.我附上了我的屏幕截图和一些代码。

应用屏幕截图

TableViewCell 代码

CollectionViewCell 代码

在awakeFromNib 函数或init 函数上的国家/地区单元格上,取决于您如何初始化单元格,在超级调用后添加行self.contentView.isUserInteractionEnabled = false

The purpose of your screen isn't really clear to me but I can suggest an interesting way to use collection views with VoiceOver:你的屏幕的目的对我来说不是很清楚,但我可以建议一种有趣的方式来使用 VoiceOver 的集合视图:

  • Define your collection view as a UIAccessibilityElement subclass.将您的集合视图定义为UIAccessibilityElement子类。
  • Set its trait to .adjustable in order to select the different elements by swiping right or left.将其特征设置为.adjustable以便通过向右或向左滑动来选择不同的元素。
  • Adapt the label and the value according to the selected cell.根据所选单元格调整标签和值。
  • Define the collection view [accessibilityElements].定义集合视图 [accessibilityElements]。

It may be tedious but that's what Apple's engineers recommend ⟹ a complete and detailed example is introduced in a WWDC session, don't hesitate to take a look at it to perfectly implement your collection view for the VoiceOver users.这可能很乏味,但这是 Apple 工程师推荐的 ⟹ 在 WWDC 会议中介绍了一个完整而详细的示例,请不要犹豫,看看它,以完美地为 VoiceOver 用户实现您的收藏视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM