【问题标题】:iOS: Accessibility: UICollectionView: UICollectionElementKindSectionHeader Read out after cellsiOS:辅助功能:UICollectionView:UICollectionElementKindSectionHeader 单元格后读出
【发布时间】:2016-04-21 17:49:04
【问题描述】:

我有一个 UICollection 视图,它有一个像这样返回的 Header 视图:

- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView
           viewForSupplementaryElementOfKind:(NSString *)kind
                                 atIndexPath:(NSIndexPath *)indexPath {
    MyView *myView = [collectionView dequeueReusableSupplementaryViewOfKind:kind
        withReuseIdentifier:@"someIdentifier"
        forIndexPath:indexPath];

    // Set various parameters on the view.
    return myView;
}

然后我显然有一堆从 cellForItemAtIndexPath 返回的单元格。

在辅助功能模式下,当我用 2 根手指向上滑动时,它会读取 Header View LAST,而不是 First。我需要先阅读它。我查看了accessibilityPoint和accessibilityFrame,两者都是正确的。标题的焦点可访问性框架肯定在单元格上方。

那么为什么它会在可访问性模式下最后读取标题视图?

示例:

【问题讨论】:

  • 更改无障碍元素顺序。

标签: ios objective-c uicollectionview accessibility


【解决方案1】:

所以这对我来说似乎是一个 iOS 错误,因为很明显应该先由 VoiceOver 读取 Header,然后再读取 Cells。

我通过让第零部分只返回标题和 0 行来解决这个问题。然后让下一部分 (1) 返回 NO 标题,只返回行。现在,VoiceOver 会以正确的顺序读取所有内容。对于用户来说,它看起来是一样的,因为他们无法判断标题是针对没有行的空白部分。

【讨论】:

    【解决方案2】:

    解决方案是将集合视图的 shouldGroupAccessibilityChildren 属性设置为 true。

    例如

    self.collectionView.shouldGroupAccessibilityChildren = true
    

    【讨论】:

      猜你喜欢
      • 2017-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-24
      • 1970-01-01
      • 1970-01-01
      • 2017-06-09
      • 1970-01-01
      相关资源
      最近更新 更多