iOS Accessibility: make UITextField and specified subview accessible
Asked Answered
I

2

8

I want to make a textfield and a subview on the text field accessible by VoiceOver. If I use UIAccessibilityContainer methods, I can only make the subviews accessible. Is there some way to do this?

Initiatory answered 23/10, 2014 at 22:11 Comment(5)
Did you find the way? It seems like Apple's voicemail implementation works that way. I also am looking for a way to do so.Alginate
I did not. There seems to be no way without major refactoring (and decreasing code and design quality).Initiatory
Actually i'm on the blink of making it to work. Try this, create a new view subclass and add it as a subview of whatever the parent view is. The role of this subview is only to contain a container and 1 element of the same size as the view. So when the VoiceOver try to access it, it will hit that element first then the rest of the subviews' accessible controls. I can show code if you are still trying it.Alginate
This is actually a complicated view hierarchy, so adding the subview to a new container subview complicates things significantly.Initiatory
Yes if you have a bunch of containers. For what I am going for is 1 container and 1 element. Other subviews can remain as accessible as before.Alginate
D
5

No. You must go up one level in the accessibility hierarchy. Implement the container protocol on your view's superview and return all of its descendants as children (and, thus, siblings of each other).

Duodiode answered 24/10, 2014 at 1:0 Comment(0)
P
-1

try this,

textfield.isAccessibilityElement = YES;

textfield.accessibilityElementsHidden = NO;

Leave the container methods for time being.

Purapurblind answered 27/10, 2014 at 11:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.