【发布时间】:2020-07-29 20:58:32
【问题描述】:
旁白未检测到 UITextView (iOS 13) 中的链接
我的以下代码适用于 iOS 12 上的配音(即,语音在向上/向下滑动时选择单个链接)但在 iOS 13 上向上/向下滑动不起作用
class ViewController: UIViewController {
@IBOutlet weak var myTextView: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
let text = "Testing https://www.google.com/ in link and 904-567-5678 is phone number"
let attributedString = NSMutableAttributedString(string: text)
myTextView.attributedText = attributedString
myTextView.isUserInteractionEnabled = false
myTextView.isEditable = false
myTextView.isSelectable = true
myTextView.dataDetectorTypes = [.link,.phoneNumber]
myTextView.font = UIFont(name: myTextView.font!.fontName,
size: 25.0)
myTextView.backgroundColor = .red
}
func textView(_ textView: UITextView,
shouldInteractWith URL: URL,
in characterRange: NSRange,
interaction: UITextItemInteraction) -> Bool {
UIApplication.shared.open(URL, options: [:])
return false
}
}
【问题讨论】:
标签: ios swift uitextview voiceover uiaccessibility