【问题标题】:iOS 7 + Calabash: UITextView with NSLinkAttributeName and accessibility on links not workingiOS 7 + Calabash:带有 NSLinkAttributeName 的 UITextView 和链接上的可访问性不起作用
【发布时间】:2014-05-05 20:58:37
【问题描述】:

我们有一个UITextView,它包含一个带有两个嵌入链接的属性字符串,这些链接是使用NSLinkAttributeName 在文本视图中创建的。我们正在使用 Calabash 来自动化测试,而 Calabash 不能“点击”这些 TextView 内的链接。我是否遗漏了什么使UITextView 中的这些链接可点击到自动化/可访问性工具?

用户可以点击这些链接,并确认预期的委托回调正在工作。唯一不起作用的情况是使用辅助工具尝试点击 UITextView 内的嵌入链接。

供参考:

 NSDictionary *plainAttributes = [self plainTextAttributes];
 NSDictionary *linkAttributes = [self linkAttributes];
 NSMutableDictionary *linkOneAttributes = [linkAttributes mutableCopy];
 termsOfUseAttributes[NSLinkAttributeName] = @"linkOne";
 NSMutableDictionary *linkTwoAttributes = [linkAttributes mutableCopy];
 privacyPolicyAttributes[NSLinkAttributeName] = @"linkTwo";

 NSMutableAttributedString *string = [NSMutableAttributedString new];
 [string appendAttributedString:[[NSAttributedString alloc] initWithString:@"Blah blah blah blah " attributes:plainAttributes]];
 [string appendAttributedString:[[NSAttributedString alloc] initWithString:@"Link One" attributes:linkOneAttributes]];
 [string appendAttributedString:[[NSAttributedString alloc] initWithString:@". Blah blah blah blah" attributes:plainAttributes]];
 [string appendAttributedString:[[NSAttributedString alloc] initWithString:@"Link Two" attributes:linkTwoAttributes]];
 [string appendAttributedString:[[NSAttributedString alloc] initWithString:@"." attributes:plainAttributes]];

非常感谢在UITextView 的属性字符串中使用NSLinkAttributeName 时对可访问性的任何见解。

【问题讨论】:

    标签: ios7 uitextview calabash uiaccessibility


    【解决方案1】:

    好吧,如果辅助功能不能自动工作并且我认为它应该自动工作,那么你唯一的改变就是覆盖 UIAccessibilityContainerUITextView 方法。

    您确定为该视图启用了辅助功能吗?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-10-19
      • 2013-11-20
      • 2016-09-28
      • 1970-01-01
      • 1970-01-01
      • 2013-09-28
      相关资源
      最近更新 更多