UITableView Cell is getting focused even when accessibility is disabled in iOS

81 Views Asked by At

Accessibility is disabled for tableview cell but it is getting selected.Tableview cell is added as a subview to a view and its accessibility is also disabled.The accessibility value is coming as empty string instead of nil.Imageview is placed inside the tableview cell for that also the accessibility is disabled, still it is getting selected for the cell.Attached the view hierarchy of tableviewcell below

enter image description here

Sample Code:

 BOOL voiceAccessibility = [screenDelegate getApplicationHasVoiceAccessibility];
    if (voiceAccessibility) {
        if (accEnabled)
        {
            [self setIsAccessibilityElement:YES];
            
            if (accLable != nil && accLable.length >0)
                [self setAccessibilityLabel:accLable];
        }
        else
        {
            [self setIsAccessibilityElement:NO];
            self.accessibilityTraits = UIAccessibilityTraitNone;
        }
    }

Accessibility View Hierachy

Code for setting the accessibility label for UITableViewCell:

-(NSString *)accessibilityLabel{
if([m_acclabel isEqualToString:@""] || m_acclabel == nil || 
m_acclabel.length == 0){
    return nil;
 }
 return m_acclabel;
 }
0

There are 0 best solutions below