iPhone UIAutomation:执行 logElementTree() 时不显示动态添加的 UI 元素
我有以下 UI 元素层次结构:
UITableView
- UITableViewCell
-- UIScrollView
--- UIWebView
--- UIWebView
--- UIWebView
现在,当我最初加载页面时,这就是显示的全部内容。但是,如果用户向右滚动,则会在用户遇到其他 UIWebView 时加载它们。例如,如果用户向右滚动多次,第四个 UIWebView 将被插入到 UIScrollView 中。
现在,当我最初加载包含所有这些元素的屏幕时,如果我在页面上执行 logElementTree(),将显示我列出的所有元素。例如,我可能会看到以下输出:
4) UIATableView [name:Empty list value:rows 1 to 1 of 1 rect:{{x:0, y:64}, {width:320, height:416}}]
5) UIATableCell [name:OfferCardTableViewCell value:(null) rect:{{x:0, y:160}, {width:320, height:416}}]
6) UIAWebView [name:(null) value:(null) rect:{{x:0, y:160}, {width:320, height:418}}]
6) UIAWebView [name:(null) value:(null) rect:{{x:320, y:160}, {width:320, height:418}}]
6) UIAWebView [name:(null) value:(null) rect:{{x:640, y:160}, {width:320, height:418}}]
但是,如果我向右滚动并将其他 UIWebView 添加到三个现有 UIWebView 中,则在执行 logElementTree()
时,新的 UIWebView 元素不会显示。我确实注意到 x 坐标已更新。例如,滚动到 UIScrollView 中的第四项后,UIAWebView 将显示为以下坐标:
6) UIAWebView [name:(null) value:(null) rect:{{x:-960, y:160}, {width:320, height:418}}]
6) UIAWebView [name:(null) value:(null) rect:{{x:-640, y:160}, {width:320, height:418}}]
6) UIAWebView [name:(null) value:(null) rect:{{x:-320, y:160}, {width:320, height:418}}]
作为参考,新创建的 UIWebView 通过调用 [scrollView addSubView:
logElementTree()
时显示新创建的 UIWebView?
谢谢。
I have the following hierarchy of UI Elements:
UITableView
- UITableViewCell
-- UIScrollView
--- UIWebView
--- UIWebView
--- UIWebView
Now, when I the page initially loads, this is all that is displayed. But, if the user scrolls to the right, additional UIWebViews will load as the user encounters them. For example, if the user were to scroll to the right multiple times as fourth UIWebView would be inserted into the UIScrollView.
Now, when I initially load the screen that contains all of these elements, if I execute logElementTree() on the page, all of the elements that I have listed will be displayed. For example, I might see the following output:
4) UIATableView [name:Empty list value:rows 1 to 1 of 1 rect:{{x:0, y:64}, {width:320, height:416}}]
5) UIATableCell [name:OfferCardTableViewCell value:(null) rect:{{x:0, y:160}, {width:320, height:416}}]
6) UIAWebView [name:(null) value:(null) rect:{{x:0, y:160}, {width:320, height:418}}]
6) UIAWebView [name:(null) value:(null) rect:{{x:320, y:160}, {width:320, height:418}}]
6) UIAWebView [name:(null) value:(null) rect:{{x:640, y:160}, {width:320, height:418}}]
But, if I scroll to the right and additional UIWebViews get added to the three existing UIWebViews the new UIWebView elements do not show up when executing logElementTree()
. I do notice that the x-coordinate has been updated. For example, after scrolling to the fourth item in the UIScrollView, the UIAWebViews would be displayed with the following coordinates:
6) UIAWebView [name:(null) value:(null) rect:{{x:-960, y:160}, {width:320, height:418}}]
6) UIAWebView [name:(null) value:(null) rect:{{x:-640, y:160}, {width:320, height:418}}]
6) UIAWebView [name:(null) value:(null) rect:{{x:-320, y:160}, {width:320, height:418}}]
For reference, the newly created UIWebViews are added to the UIScrollView by invoking [scrollView addSubView:<new_UIWebView_object>]
. What do I need to do so that the newly created UIWebViews show up when I execute logElementTree()
?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要解决此问题,您需要在添加或删除元素时使用
UIAccessibilityPostNoficiation
函数。UIAccessibilityLayoutChangedNotification
通知可能会起作用。如果失败,请尝试UIAccessibilityScreenChangedNotification
。To work around this problem, you need to use the
UIAccessibilityPostNoficiation
function when an element is added or removed. TheUIAccessibilityLayoutChangedNotification
notification will probably work. Failing that, tryUIAccessibilityScreenChangedNotification
.