UITextView 可链接标签辅助功能旁白问题 [英] UITextView Linkable label Accessibility Voice Over Issue

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

问题描述

我有一个 UITextView 并且部分文本是可点击的.链接有效.当我在 iPhone 的设置中打开辅助功能并打开 Voice over 时,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天全站免登陆