0

Trying to get Voice Control with a UILabel to work in iOS 16.

let label = UILabel()
label.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(test)))
label.text = "Title Label"
label.accessibilityLabel = "Title Label, tap me"
label.isAccessibilityElement = true
label.isUserInteractionEnabled = true
label.accessibilityTraits = [.allowsDirectInteraction, .button]

This code works fine in iOS 15, but in iOS 16 it's not tapable via Voice Control anymore. The funny thing is that it works if I change it from UILabel to UIView so there must be something new especially for UILabel in iOS16.

Any suggestions? (Has to work with a label, I can't use a button for various reasons)

Markus
  • 599
  • 1
  • 5
  • 18

0 Answers0