0

The UITableViewCells of my UITableView each contain their own table view with just one cell.

VoiceOver works fine selecting the cells of the main table view, but I can't figure out how to make the inner cells/table view selectable by VoiceOver.

Does anyone know how to make a UITableView inside of a UITableViewCell selectable by VoiceOver?

Jon Cox
  • 10,622
  • 22
  • 78
  • 123
  • Couple notes... first, *"not ideal, but requirements"* ... sometimes we need to change the requirements. *"on button tap, phone needs to sprout wings and fly across the room"* may be a fine requirement, but not necessarily doable. Not saying your "cell in a table in a cell in a table" **cannot** be done, but maybe it needs to be justified. What are you actually trying to accomplish? – DonMag Jun 02 '22 at 17:55
  • Essentially what I'm trying to do is have a button within the cell, but that responds to user input like a UITableViewCell. As a UIButton would capture any touch down and prevent scrolling, and also has a slightly different highlight effect. – Jon Cox Jun 03 '22 at 07:11
  • I guess I would need to see an example to understand the need for your structure... I haven't done any work with VoiceOver / accessibility, but this answer (and its contained links) may be helpful - https://stackoverflow.com/a/57372335/6257435 – DonMag Jun 03 '22 at 12:22

2 Answers2

0

You can use the UIAccessibilityCustomAction to select the inner cell by assigning each with a selector.

UIAccessibilityCustomAction(
    name: "Call",
    target: self,
    selector: #selector(activateCallButton) // Your inner cell name
),
UIAccessibilityCustomAction(
    name: "Open address in Maps",
    target: self,
    selector: #selector(activateLocationButton)
)

Reference - Apple docs

Hope it helps.

Nikulsinh Sodha
  • 381
  • 3
  • 14
  • Thanks for the answer Nikulsinh, but unfortunately while that makes it possible to selection the action the inner cell performs, it doesn't make the inner cell itself selectable by VoiceOver. As in, it doesn't make it possible to tap on the inner cell to select it. – Jon Cox Jun 02 '22 at 11:07
  • Okie I thought you wanted to perform its action. There must be some help in the link of docs I mentioned. There where many different methods and ways for VoiceOver accessibility. – Nikulsinh Sodha Jun 02 '22 at 11:10
0

as an alternative approach, if you can place each section (the specific cell you are referring to for e.g. table view and a button) inside their own containers, this allows Voice Over users to easily navigate between the various cells using the containers (plus any navigation like rotor).

Now you can do this by giving the containing view of the specific cell (of the example of button and the table view each) an accessibilityContainerType of UIAccessibilityContainerTypeSemanticGroup then your VoiceOver should work

Transformer
  • 6,963
  • 2
  • 26
  • 52