I am trying to set a custom view inside UITableViewCell, which of course lives within UITableView. I want to make this custom view available, so I need to make it UIAccessibilityContainer(since it contains several visual elements that are not implemented as their own UIViews).
When I do this, the arrangement of the elements will get corrupted whenever the table scrolls. While paging through elements using VoiceOver, it automatically scrolls the table to try to center the selected element on the screen, but then a plan in which VoiceOver considers that the element no longer matches where it is visually.

, " 4, 2", - 7, , Row 4 , .
, , , UIAccessibilityPostNotification(), , , , UIAccessibilityContainer, , , , UIAccessibilityElement accessibilityFrame, , , . ( : API, ? - ? Arg.)
, - , . (Xcode 4) .
@implementation CellView
@synthesize row=_row;
- (void)dealloc
{
[_accessibleElements release];
[super dealloc];
}
- (void)setRow:(NSInteger)newRow
{
_row = newRow;
[_accessibleElements release];
_accessibleElements = [[NSMutableArray arrayWithCapacity:0] retain];
for (NSInteger i=0; i<=_row; i++) {
UIAccessibilityElement *element = [[UIAccessibilityElement alloc] initWithAccessibilityContainer:self];
element.accessibilityValue = [NSString stringWithFormat:@"Row %d, element %d", _row, i];
[_accessibleElements addObject:element];
[element release];
}
[self setNeedsDisplay];
}
- (void)drawRect:(CGRect)rect
{
[[UIColor lightGrayColor] setFill];
UIRectFill(self.bounds);
[[UIColor blackColor] setFill];
NSString *info = [NSString stringWithFormat:@"Row: %d", _row];
[info drawAtPoint:CGPointZero withFont:[UIFont systemFontOfSize:12]];
[[[UIColor whiteColor] colorWithAlphaComponent:0.5] setFill];
NSInteger x=0, y=0;
for (NSInteger i=0; i<=_row; i++) {
CGRect rect = CGRectMake(12+x, 22+y, 30, 30);
UIAccessibilityElement *element = [_accessibleElements objectAtIndex:i];
element.accessibilityFrame = [self.window convertRect:[self convertRect:rect toView:self.window] toWindow:nil];
UIRectFill(rect);
x += 44;
if (x >= 300) {
x = 0;
y += 37;
}
}
}
- (BOOL)isAccessibilityElement
{
return NO;
}
- (NSInteger)accessibilityElementCount
{
return [_accessibleElements count];
}
- (id)accessibilityElementAtIndex:(NSInteger)index
{
return [_accessibleElements objectAtIndex:index];
}
- (NSInteger)indexOfAccessibilityElement:(id)element
{
return [_accessibleElements indexOfObject:element];
}
@end
. , , accessibilityFrame -indexOfAccessibilityElement: -accessibilityElementAtIndex: , VoiceOver -, , d . . , VoiceOver , . ( -drawRect: , , WWDC , , " " .)