2

我在 UIAutomation 上观看了 Apple 的视频,并看到了一些关于它的在线教程。大多数人说要么在代码中设置可访问性标签,例如:

self.helpButton.accessibilityLabel = @"helpButton";
self.helpButton.isAccessibilityElement = YES;

或者使用IB。当我尝试上面的代码时,我的脚本发现按钮很好,我可以通过我的脚本点击它。但是,如果在我的故事板中,我单击启用辅助功能复选框,然后我制作标签:helpButton,我的代码找不到此按钮。当我记录 elementTree 时,我得到了这个:

UIAWindow ->
  UIAButton: name: Help rect: {...}

我的按钮的标题是帮助,但可访问性标签设置为 helpButton。我不明白为什么 logElementTree() 的按钮名称为 Help(IB 中的标题),而不是 helpButton(accessibilityLabel)。有什么想法吗?谢谢!

4

0 回答 0