如何在 isAccessibilityElement = false 时禁用元素的可访问性焦点
How to disable accessibility focus of an element while its isAccessibilityElement = false
我以不同的方式关闭了 UITableViewCell 的辅助功能。但是,选中后仍可聚焦。
override public func awakeFromNib() {
super.awakeFromNib()
selectionStyle = .none
}
convenience init() {
self.init()
isAccessibilityElement = false
}
public override func didMoveToWindow() {
super.didMoveToWindow()
isAccessibilityElement = false
isUserInteractionEnabled = false
subView.isAccessibilityElement = false
}
public override var canBecomeFocused: Bool {
return false
}
这是视图调试器的屏幕截图:
有线索吗?
谢谢
制作accessibilityElementsHidden = true
解决了。
public override func didMoveToWindow() {
super.didMoveToWindow()
isAccessibilityElement = false
accessibilityElementsHidden = true
}
我以不同的方式关闭了 UITableViewCell 的辅助功能。但是,选中后仍可聚焦。
override public func awakeFromNib() {
super.awakeFromNib()
selectionStyle = .none
}
convenience init() {
self.init()
isAccessibilityElement = false
}
public override func didMoveToWindow() {
super.didMoveToWindow()
isAccessibilityElement = false
isUserInteractionEnabled = false
subView.isAccessibilityElement = false
}
public override var canBecomeFocused: Bool {
return false
}
这是视图调试器的屏幕截图:
有线索吗? 谢谢
制作accessibilityElementsHidden = true
解决了。
public override func didMoveToWindow() {
super.didMoveToWindow()
isAccessibilityElement = false
accessibilityElementsHidden = true
}