I’ve created a custom button and set two images, one is for normal, and the other is for the selected mode. But the voice-over always says the normal image name text when the button is not selected. I’ve tried a lot but could not disable it.
When I disable the button imageView accessibility it is not working.
button.imageView?.isAccessibilityElement = false
When I disable the button accessibility, the voice-over is not working in accessibility mode.
button.isAccessibilityElement = false
If I remove the ‘.normal’ mode image then it works, but normal mode image functionality is not considered/worked there. I’m surfing a lot. Help anyone and thanks in advance.
Code:
self.setImage(UIImage.init(named: imageName1), for: .normal)
self.setImage(UIImage.init(named: imageName1), for: .selected)
3
Answers
I found an alternative solution. I think it is not a proper solution. Nonetheless, I am sharing this alternative solution. The question is open if anyone gets any proper solutions. Thanks!
You can do it with a simple function, this is an example…
Declare your image and your button under controller class:
in viewDidLoad addTarget to your button and call the control function, in my case:
now set control variable and handleCange() func
Basically, it is not possible indirect way. On the other hand we can use accessibilityLabel