Reputation: 51
I'm trying to enable VoiceOver accessibility on my collection view which behaves as follows:
For step 1, voiceover reads out the item just fine, and it'll be the focus after the layout change.
However, for step 2, things get a bit weird. It'll start reading out the item, and just before it finishes, the focus jumps to another item, and begins reading that one instead.
From Apple's documentation about collection views, it automatically posts a layout change notification when a layout occurs. But, from the looks of it, it's passing on some random element to the first focus element after the layout change.
When a collection view changes its onscreen layout, it posts the UIAccessibilityLayoutChangedNotification notification.
Is there anyway to override this automatic layout changed notification, so that I can pass in the correct focus element?
Upvotes: 1
Views: 958
Reputation: 51
I found the reason for what was happening. The reason an element was randomly focusing was because I was calling reloadData on the collectionview in the performBatchUpdate's completion block. Removing the reloadData solved this problem. However, because I'm not calling reloadData, I had to call reloadItemsAtIndexPaths on specific cells, which is fine in my case.
Upvotes: 1