问题
I have a UITableView where each UITableViewCell has 2 UILabels: 1 header and 1 content. The AccessibilityTrait of the header is set to "header". I'm able to see the trait set correctly when inspecting the simulator screen with Accessibility Inspector. But on the actual device, when I switch the rotor to "Headings", it only finds the navigation bar header, but does not find the headers in the UITableViewCells.
回答1:
To get the accessibility elements with the header trait in your table view cells, you should select the container your rotor inspects (here, the table view).
When you arrive on your page, the rotor inspects the headers in the main container, not in all the others that could exist inside this one.
To reach your goal :
- Select the
Containers
rotor item to know if many of them are present on the page. - Select the
Headings
rotor item for each container to get its headers elements.
I don't provide a solution here but that's the way VoiceOver works and, in my view, you should adopt another architecture for your app because it's a little bit messy for the user.
来源:https://stackoverflow.com/questions/54538930/ios-voiceover-heading-not-found