UIAccessibility Tableview Scrolling Issue

2.9k Views Asked by At

I have implemented Accessibility for a custom table view. Where I enabled the accessibility for all the subview of table cell like imageview,label,button,textfields.

I am facing 2 issues after implementing accessibility.

  1. Because of the the accessibility frame focus the tableviewcell frame is acting so weird. It goes either left or right on voiceover swipe event.Focus making the view frame to align based on the selection.

  2. If the number of cells are more then scrolling is not working. Till the cells are visible accessibility is working fine. Once the focus goes to invisible cells some time the tableview is scrolling according to the voiceover selections but not as expected.

I have implemented these following methods.

-(BOOL)isAccessibilityElement
{
    return NO;
}

-(NSInteger)accessibilityElementCount
{
    return self.subviews.count;
}

-(id)accessibilityElementAtIndex:(NSInteger)index
{
    return [self.subviews objectAtIndex:index];
}

-(NSInteger)indexOfAccessibilityElement:(id)element
{
    return [self.subviews indexOfObject:element];
}

-(BOOL)shouldGroupAccessibilityChildren
{
    return YES;
}

I read that these methods will not work in viewcontroller. so I am implementing these in cell class.

Do you have any idea how can I solve this accessibility Issues? Please help with your valuable suggestions.

1

There are 1 best solutions below

0
On

Issue #1 can occur if your subviews (labels, buttons, as you mention) have frames that extend to larger than the size of the screen.

One visual way to verify if this is the case is to change the color of the subview: you will notice on the accessibility focus shift if a particular subview extends further than your other views.

Decrease the size of your subview frames to resolve.