UIBarButton 中的 accessibilityUserInputLabel

问题描述

我正在尝试将 accessibilityUserInputLabels 分配给 UIBarButtonItem 以进行语音控制以显示特定名称;见下面的代码

     /// Button 
  lazy var groupButton: UIBarButtonItem = {
    var button = UIBarButtonItem(imageName: "FunctionGroup1",target: self,action: #selector(barButtonHandler))
    button.accessibilityLabel = "Goodbye!"
    button.accessibilityUserInputLabels = ["Hello!"]
    return button
  }()

但按钮只显示按钮的accessibilityLabel 而不是accessibilityUserInputLabels。

我使用的是 iOS 14 和 Xcode 12.4。

我错过了什么?

编辑 2021 年 5 月 11 日:问题已报告给 Apple;见this

解决方法

我有一个带有 UIBarButtonItemsimilar issue 不尊重 VoiceOver 中的辅助功能属性。我向 Apple 报告了这个错误,它在 iOS 14.5 中得到了修复。如果这种行为是他们遗漏的另一个错误,我不会感到惊讶(我在 14.5 中复制了您的示例)。你应该报告这个:)