I have UIAlertController
with a message. I want the alert message accessibility label to be different than the alert message string.
How can I do that?
I have UIAlertController
with a message. I want the alert message accessibility label to be different than the alert message string.
How can I do that?
you can find each UIControl
element using subviews
array.
For example if you want to change accessibilityLabel
of your UIAlertController
you can do this:
let contentTitleForAlert = myAlertController.view.subviews[0].subviews[0].subviews[0].subviews[0].subviews[0].subviews[0]
contentTitleForAlert.accessibilityLabel = "¡My text for accessibility label"
Using this way you can change other elements in the UIAlertController
. For example:
let contentLabelForAlert = myalertController.view.subviews[0].subviews[0].subviews[0].subviews[0].subviews[0].subviews[1]
contentLabelForAlert.accessibilityLabel = "Text for accessibilityLabel for main content in UIAlertController."