【问题标题】:Getting UITableViewCell from UIAccessibilityElement从 UIAccessibilityElement 获取 UITableViewCell
【发布时间】:2014-02-12 22:09:04
【问题描述】:

我正在使用 KIF 框架,并且可以从各种 API 获取 UITableViewCellAccessibilityElement 以获取名为 RDTokenCell 的特定 UITableViewCell 子类。

(lldb) po element
[UITableViewCellAccessibilityElement - 0x148c9f30] <RDTokenCell: 0x14bf6db0;
baseClass = UITableViewCell; frame = (0 0; 320 50);
text = 'Fake Group 331'; autoresize = W;
layer = <CALayer: 0x14bf6f80>>) <NSIndexPath: 0x1596e2b0>
{length = 2, path = 0 - 0} - Recipient Fake Group 331

但是,当我调用 element.accessibilityContainer 时,它会返回包含 UITableView 而不是元素引用的 UITableViewCell

为什么会这样?如何获取单元格而不是表格视图?

【问题讨论】:

    标签: uitableview uiaccessibility kif


    【解决方案1】:

    有一个额外的UIView 覆盖UITableViewCell,直到在我的用户界面中按X 按钮关闭。显然,阻塞UIView 迫使UITableViewCellaccessibilityContainer 到父UITableView

    我强制KIF首先关闭顶层UIView,指示它按下X按钮,然后所有UITableViewCells都可以访问。

    故事的寓意,如果 UIView 覆盖了可访问性元素,则可访问性容器可能默认为所包含元素的父视图。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多