为什么我的视图中的按钮不能被UIAutomation看到?

Ald*_*ich 5 iphone ios ios-ui-automation

我能够看到视图,但我无法看到/点击其中的按钮.该按钮具有UIA_loginview_loginbutton的辅助功能标签,并且启用了辅助功能.为什么它没有显示在logElementTree()上?

var target = UIATarget.localTarget();
var application = target.frontMostApp();
var window = application.mainWindow(); 
var view = window.elements().firstWithName("UIA_loginview_view"); 


UIATarget.localTarget().logElementTree();
UIATarget.localTarget().frontMostApp().logElementTree();


if(view == null || view.toString() == "[object UIAElementNil]") 
{
UIALogger.logFail("View not found - "+view.toString());
} 
else
{
    UIALogger.logPass("View found - "+view.toString());
    UIALogger.logMessage("View Elements length - "+view.buttons().length);
    view.buttons()["UIA_loginview_loginbutton"].tap();
}
Run Code Online (Sandbox Code Playgroud)

日志元素树://显示我的视图,但不显示其中的按钮

4)UIAElement [name:UIA_loginview_view value:(null)NSRect:{{0,20},{320,460}}]

Ren*_*lin 12

确保按钮的可访问性属性未被其容器视图隐藏.只有那些应该由用户可访问的元素才应该被标记为这样.如果在Interface Builder中将容器视图设置为启用"可访问性",则UIAutomation将无法显示hierarchie中的所有子元素.

这有帮助吗?