UITextView可链接标签辅助功能配音 [英] UITextView Linkable label Accessibility Voice Over Issue

查看:114
本文介绍了UITextView可链接标签辅助功能配音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UITextView,文本的一部分是可单击的。链接有效。当我在iPhone的设置中打开辅助功能并打开语音功能时,将读取textview的文本,但链接不起作用。启用了文本视图的情节提要上的可访问性功能,并且还在可访问性属性下选择了链接,并且在打开配音时该链接不起作用。我也尝试过将isAccessbilityElement = true添加到textview并最终没有运气。



UITextView已添加到表视图的自定义单元格中。



预先感谢您的建议。

解决方案

问题解决了使用


  1. 在链接上方显示一种弹出窗口

  2. 一旦出现操作表,请向右轻拂以获取 Open 动作。

  3. 双击以打开URL并获取第7步的最后一个屏幕。



唯一要记住的是双击并按住直到弹出窗口出现在链接上方


I have a UITextView and portion of the text is clickable. Link works. When I turn the accessibility feature in settings of the iPhone and turn on Voice over as well, the text of the textview is read out but the link is not working. The accessibility feature on storyboard of the textview is enabled and also link is selected under accessibility attributes and the link does not work when voice over is turned on. I have also tried adding isAccessbilityElement = true to the textview and ended up with no luck.

UITextView is added to the custom cell on a table view.

Thanks in advance for your suggestions.

解决方案

The problem deals with a specific VoiceOver gesture to be used when a link must be activated in a UITextView.

I created a blank project including the code snippet hereafter to get 2 URLs in the myTextView element :

class TextViewURLViewController: UIViewController, UITextViewDelegate {

    @IBOutlet weak var myTextView: UITextView!

    let myString = "Follow this developers guide if you already know the VoiceOver gestures."
    let myDevURL = "https://a11y-guidelines.orange.com/mobile_EN/dev-ios.html"
    let myGesturesURL = "https://a11y-guidelines.orange.com/mobile_EN/voiceover.html"


    override func viewDidLoad() {

        let attributedString = NSMutableAttributedString(string: myString)

        attributedString.addAttribute(.link,
                                      value: myDevURL,
                                      range: NSRange(location: 12,
                                                     length: 17))

        attributedString.addAttribute(.link,
                                      value: myGesturesURL,
                                      range: NSRange(location: 52,
                                                     length: 19))

        myTextView.attributedText = attributedString
        myTextView.font = UIFont(name: myTextView.font!.fontName,
                                 size: 25.0)
    }


    func textView(_ textView: UITextView,
                  shouldInteractWith URL: URL,
                  in characterRange: NSRange,
                  interaction: UITextItemInteraction) -> Bool {

        UIApplication.shared.open(URL, options: [:])
        return false
    }
}

Follow the steps hereunder to activate the link :

  1. Get the rotor links item with the appropriate gesture.
  2. Swipe up or down with one finger to reach the link.
  3. Double tap and hold until you see the screen on step 4.

  1. A kind of popup shows up above the link.
  2. Once the action sheet appears, flick right to get the Open action.
  3. Double tap to open the URL and get the last screen on step 7.

The only thing to remember is the double tap and hold until the popup appears above your link.

这篇关于UITextView可链接标签辅助功能配音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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