Turning off Voice-over focus for a cell in table view and not for others

accessibility, ios

Solution

use some cutom cell, and within that cell definition implement this:

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

Problem

The first cell in my table view is a dummy cell and thus, when Voice-over mode is ON, I want to skip that cell so that the focus does not come to that control and thus, none of its traits are spoken by the Voice over. I wrote the code pasted below to acheive the same, thinking that `isAccessibilityElement` alone is sufficient for this. But it seems that is not the case. Even though this element i said to be non-accessible in the code, still its getting focus by right/left flicks in `Voice-over` mode. Any idea as to 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; } } ```

Original source