Home > Blockchain >  Image inside a type of custom button (for normal), voice over mode is saying image name. How can I d
Image inside a type of custom button (for normal), voice over mode is saying image name. How can I d

Time:10-24

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)

CodePudding user response:

Simply, It is not possible. You can use an accessibility label instead.

button1.imageView?.accessibilityLabel = "Radio button deselected"
  • Related