Disabling voice focus for a cell in a table format, and not for others

The first cell in my table view is a dummy cell, and so when the voice mode is turned on, I want to skip this cell so that the focus does not fall into this control and, thus, none of its features are spoken by the Voice. I wrote the code inserted below to get the same, considering that isAccessibilityElement enough for this. But this does not seem to be the case. Despite the fact that this element, which, as I said, is not available in the code, still focuses on right / left clicks in Voice-over mode. Any idea on how this can be achieved?

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { .... UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier]; if(indexPath.row == 0) { cell.isAccessibilityElement = 0; } } 
+4
source share
3 answers

use some cutom cell, and inside this cell definition implement this:

 - (NSInteger)accessibilityElementCount { NSIndexPath *indexPath = [(UITableView *)self.superview indexPathForCell: self]; if(indexPath.row==0){ return 0; } else{ return 1; } } 
+1
source

The current way of doing this seems to set the accessibilityElementsHidden in the cell to true / YES (depending on whether Swift or Obj-C is used.

Seems cleaner than the other answers suggested, and seems effective in my very brief testing.

+1
source

Not perfect, but can you only display a cell when VoiceOver is not activated? you can use

 UIAccessibilityIsVoiceOverRunning() 

Function to see if VoiceOver is turned on when your application loads and register

 @selector(voiceOverStatusChanged) 

A notification so you can find out if the user is on or off the voice acting. See the next blog post for more on this. < http://useyourloaf.com/blog/2012/05/14/detecting-voiceover-status-changes.html >

0
source

Source: https://habr.com/ru/post/1442965/


All Articles