Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIAccessibilityContainer in child view controllers?

I have a parent UIViewController to which I add four child view controllers. I’m trying to manage accessibility throughout those controllers. I have a status enum which keeps track of which of those children are visible on-screen, so when that changes, I’m updating the accessibilityElementsHidden of the children as appropriate, and sending a LayoutChanged notification.

My question relates to implementing the UIAccessibilityContainer protocol in both the parent view controller, and inside each of the child view controllers. The parent needs to know in which order those elements should be presented, etc., and each child has its own elements that also need specific ordering.

It appears that inside the children, the UIAccessibilityContainer methods (accessibilityElementCount et al), are never called, so it looks like it’s ignoring them, which leaves my elements out of order and messy.

Is this how it’s supposed to be? Could I possibly be doing something wrong here?

like image 927
Luke Avatar asked Nov 23 '25 19:11

Luke


1 Answers

The reason why your UIAccessibilityContainer methods are not being called is because they are defined as part of your view controller. They must be defined as part of your custom view to be called.

I'm just digging into UIAccessibility with my own layered view controllers so I don't have an answer to how to fix your ordering. I'll update this post if I can figure it out.

like image 149
Dan Loughney Avatar answered Nov 26 '25 09:11

Dan Loughney



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!