Xcode UIAutomation 无法与 TTTAttributedLabel 交互 [英] Xcode UIAutomation can't interact with TTTAttributedLabel

查看:25
本文介绍了Xcode UIAutomation 无法与 TTTAttributedLabel 交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的应用编写自动化脚本,但我的问题是 Xcode UI 自动化无法看到 TTTAttributedLabel 类.获取完整的元素树没有显示那些 TTTAttributedLabel 元素的迹象.我使用的是 Xcode 6.1.1

I'm trying to write automation scripts for my app and my problem is that Xcode UI Automation just can't see the elements of TTTAttributedLabel class. Getting full elements tree shows no sign of those TTTAttributedLabel elements. I'm using Xcode 6.1.1

推荐答案

默认情况下 TTTAttributedLabel 不是可访问性元素.它用作自定义容器,并为链接/电话和其他检测到的数据提供可访问性.更改此行为的子类 TTTAttributedLabel 并覆盖 UIAccessibilityElement 协议的方法.

By default TTTAttributedLabel isn't an accessibility element. It works as custom container and provides accessibility for links/phones and other detected data. To change this behaviour subclass TTTAttributedLabel and override methods of UIAccessibilityElement protocol.

例如在 -(BOOL)isAccessibilityElement 方法中返回 YES 并且 TTTAttributedLabel 将作为 UILabel

E.g. return YES in -(BOOL)isAccessibilityElement method and TTTAttributedLabel will work as UILabel

这篇关于Xcode UIAutomation 无法与 TTTAttributedLabel 交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆