我正在研究日历的可访问性,它实际上是一个 collectionView。每当点击单元格时,collectionView 将通过调用重新加载
[self.collectionView reloadData];
问题是如果 VoiceOver 正在运行,则在点击单元格后焦点将移动到另一个位置,因为该单元格在其他地方被重用。
无论如何,在 reloadData 之后是否可以将焦点保持在原来的位置?谢谢!
最佳答案
只需为此找到一个解决方法。焦点已更改,因为在执行 [colleciontView reloadData] 时,焦点单元格在其他地方被重用。
因此,如果我们一个一个地重新加载 collectionViewCells,则该焦点单元格将不会在其他任何地方使用。我调用此方法在 VoiceOver 运行时重新加载 collectionView。
- (void)reloadCalendarCollectionView {
NSInteger items = [self.calendarItems count];
for (NSInteger i = 0; i < items; i++) {
[self.collectionView reloadItemsAtIndexPaths:@[[NSIndexPath indexPathForItem:i inSection:1] ]];
}
}
关于ios - 可访问性 collectionView 焦点在重新加载时发生变化,iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35462545/