我有一个文本“用户可以在这里进行更改'。”这里的字母是可点击的,并点击它。[检查图像] [1]UIAccessibility -Voice over not for an NSMutableAttributedString
默认的语音结束并不关注它,也不会读出它。
我怎样才能使它与语音重点,使其可点击并发音的名称。
为UI标签创建了一个扩展,并从NSRange计算属性文本框架。
let attribute : [String : Any] = [NSForegroundColorAttributeName: Theme.getColor(forCode: "LinkBlue")]
let strToUse = contentForKey("String")
range = (footerText as NSString).range(of: strToUse)
let attributedString = NSMutableAttributedString(string: footerText)
if let textRange = range{
attributedString.addAttributes(attribute, range:textRange)
}
footerVw.headerTitleLabel.attributedText = attributedString
footerVw.isUserInteractionEnabled = true
let tap = UITapGestureRecognizer(target: self, action: #selector(MyProfileViewController.showPage))
footerVw.headerTitleLabel.addGestureRecognizer(tap)
在此先感谢。
此代码片段不够,缺少大量上下文信息。什么是footerVw? VoiceOver是否有任何这种观点受到关注?等。 – ChrisCM
是它的重点。它专注于整个标签(包括“这里”)。我希望它能够单独聚焦并阅读 – Mahesh
您应该创建两个单独的UILabel(或者可能是UILabel和UIButton),并对它们进行类似的设计并将它们排列在一起。 – ChrisCM