gpt4 book ai didi

ios7 - iOS 7 + 葫芦 : UITextView with NSLinkAttributeName and accessibility on links not working

转载 作者:行者123 更新时间:2023-12-02 12:14:01 30 4
gpt4 key购买 nike

我们有一个 UITextView,其中包含一个带有两个嵌入链接的属性字符串,这两个链接是使用 NSLinkAttributeName 在 TextView 中创建的。我们正在使用 Calabash 来自动化测试,并且 calabash 无法“点击”这些 TextView 内部的链接。我是否遗漏了一些东西,使 UITextView 内的这些链接可用于自动化/辅助工具?

用户可以点击这些链接,并且确认预期的委托(delegate)回调正常工作。唯一不起作用的情况是使用辅助工具尝试点击 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 时的可访问性,我们将不胜感激。

最佳答案

好吧,如果辅助功能不能自动工作,而我认为它应该自动工作,那么您唯一的更改就是重写该 UITextViewUIAccessibilityContainer 方法。

您确定已为该 View 启用了辅助功能吗?

关于ios7 - iOS 7 + 葫芦 : UITextView with NSLinkAttributeName and accessibility on links not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23481759/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com