简体   繁体   中英

UICollectionView Section Headers as Accessibility Headers

I have two questions regarding accessibility and UICollectionViews that I'm hoping to get some expert help with. The other question, regarding Voice Over read order, is here . I've created a sample project demonstrating both issues.

I have a UICollectionView where I'm providing custom section headers. These section headers are accessibility elements and have the accessibility trait UIAccessibilityTraitHeader set. When Voice Over is enabled, and the user is swiping horizontally through the collection, the header is announced properly, and it is even declared as a header. However, if the user swipes up or down to the next header, Voice Over will only jump to another header if it is visible. I'm assuming this is because when a view isn't visible in a collection view, it's removed from the view hierarchy and Voice Over no longer knows it exists.

You can pull this example project , run it, enable voice over, and use the dial to set the swipe up/down to headings to view the issue.

Is there a way I can allow the user to jump to a header that is not currently visible? Any help would be greatly appreciated.

You might have to use the scrollToItemAtIndexPath:atScrollPosition:animated: property of the UICollectionView to scroll the header into view before VoiceOver can read it.

You can find out which indexPath you are currently at via indexPathForItemAtPoint: using the position of where they touched within the collection view and then you know which section comes after.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM