gpt4 book ai didi

ios - 在 UIView 的 Accessibility Rotor VoiceOver 中启用链接

转载 作者:行者123 更新时间:2023-11-28 21:50:17 24 4
gpt4 key购买 nike

我有一个 UIView,其中包含一堆 subViews。其中之一是 UILabel,它可以包含一个或两个链接。

我希望画外音能够读取我为 View 设置的任何内容,但允许用户将转子更改为 Links。用户可以上下滑动不同的链接。

我知道 Links 本身可以与 UIWebView 一起使用,但我找不到任何关于它的文档,无论这是否可能。我也在研究 UITextView 但这是最​​后的手段,因为如果我进行切换,我有很多遗留代码需要修剪。

最佳答案

不幸的是,您不能向转子添加项目,但从 iOS8 开始,您可以添加一个 UIAccessibilityCustomAction,它允许用户在转子中选择“操作”。然后用户可以向上滑动以选择您的项目,然后双击以激活该项目。

以下是添加 UIAccessibilityCustomAction 的方法:

UIAccessibilityCustomAction *customAction = [[UIAccessibilityCustomAction alloc] initWithName:@"Next link" target:self selector:@selector(nextLink:)];
NSMutableArray *customActions = [NSMutableArray arrayWithArray:self.accessibilityCustomActions];
[customActions addObject:customAction];
self.accessibilityCustomActions = customActions;

然后您可以跟踪您的链接并允许用户在 nextLink: 方法中浏览它们。

关于ios - 在 UIView 的 Accessibility Rotor VoiceOver 中启用链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28593043/

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