How to set accessibility labels for individual view controller's

I have a scenario where I need to set accessibility labels on individual table cells, across different page views. The application view is designed in way where there are individual tabs, and clicking on each tab will load its own view controller, and returns the data in a collection cell. The problem here is, once we click on the tab, the accessibility inspector still has a reference to the previous view, and does not load the accessibility labels on the new view.

[![enter image description here][1]][1]

For example, here Item0, Item1, Item2 …are individual tabs, which when clicked upon, will invoke the corresponding view controllers, and return their own data.

The issue here is the Back Button, and the greyed out boxes, Item tabs, remain the same for every tab, and it is only the content inside the table footer (From Length Section to Heading 5 section) gets changed. For each view, different data gets loaded. In the screenshot below, I have set the accessibility label for Item1 View as 11, and upon navigating to the Item0 view, the accessibility inspector still shows the accessibility labels corresponding to Item1 view. Since there has been a layout change, I have sent an UIAccessibilityLayoutChangedNotification, but it does not work. I have set the isAccessibilityELement, accessibilityValues, disabled the accessibility on the container, and make the cell instead accessible, but I am missing out on something. Could someone please help.

Hey there
You’re probably already ahead of me but.
Have you tried this using Appium’s Inspector or ARC?
Perhaps those views are seen under a different window somehow.
Probably not, but just a thought.


Thanks Eric, actually with Appium inspector, the elements were not showing up. So I was trying to modify the application code, and check if it makes the elements visible on the accessibility inspector (I was assuming in most cases, if accessibility inspector shows the elements, appium inspector will show the elements). But yeah, the elements do not show up in appium inspector.

Hi @Eagle_Claw,
Wow it sounds like you’ve thought of just about everything!
My only 2 thoughts are that a) you’re dealing with some custom views or b) some of your subviews are not inheriting properly.

Somewhat of an edge-case guess, I’m wondering if you have to call initWithAccessibilityContainer.
Here’s some more info that I dug up here. Hope it helps.

Worst case, if you’re up for it, I can try and tinker with things. I can’t promise anything :smile:

Good luck!

Oh thanks Eric, I have not tried that approach, the initWithAccessibilityContainer. I will look more into it, but as per the apple’s documentation, it says, the initWithAccessibilityContainer is required for images or icons. Currently our application does not have any images. And looks like the accessibility labels work fine when the view is loaded for the first time. The problem occurs when we move back and forth between different views. I have been struggling with it for the past few days, didnt make much progress though.

Thanks for the initiation Eric :smile:

No problem. I’m pretty much now out of my league on this conversation.
I did, however, stumble on to this Post by Hotel Tonight

It does talk about Detail Tab Improvements. Maybe there’s something they’re doing here that you might need to modfiy?

Good luck!!