Reputation: 5792
I'm trying to get accessibility to work in my app. I want the exact same behavior as the "App Store" app, in the "Featured" page:
A tableview
where each row contains a collectionView
with some cells. I want to use VoiceOver to go thru all of the cells of a collectionView
, then move to the next collectionView's
cells.
The VoiceOver works when I swipe right and moves from cell to cell. The problem is that once I reach the last cell of a collectionView
, instead of moving to the next collectionView
, the VoiceOver gets stuck on that last cell. The app doesn't crash but stops responding.
I'm using this code in the UICollectionViewCell subclass to get the collectionView
to scroll right when I reach the last visible cell:
override func accessibilityElementDidBecomeFocused() {
let cv = self.superview as! UICollectionView
let path = cv.indexPath(for: self)!
if self == cv.visibleCells.last {
cv.scrollToItem(at: path, at: .centeredHorizontally, animated: false)
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, self)
}
}
How can I solve this?
Thanks
Upvotes: 5
Views: 2265
Reputation: 299
Maybe implement - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction
Upvotes: 1