Jordan H
Jordan H

Reputation: 55665

Prevent VoiceOver from navigating other pages of UICollectionView

I have a paging UICollectionView that allows the user to swipe through the collection view cells horizontally. It does have two pages but at times I want to disable that so that users cannot navigate past the first page.

I am currently setting the page control's numberOfPages to 1 and scrollEnabled = false on the collectionView, and this does stop the user from 3-finger swiping to go to the other page, but it doesn't prevent accessing that page using other methods. If they tap the button that comes after the collection view then they swipe left to go to the previous element, it focuses on the last cell on the second page of the collection view.

I then tried also setting pagingEnabled = false, but then if the user highlights the last cell in the first row then swipes right, then it will scroll over so you can see half of the first page and half of the second page and it highlights the first character of that second page.

How can I prevent VoiceOver from navigating to the second page of the collection view?

Upvotes: 2

Views: 2288

Answers (1)

Basheer_CAD
Basheer_CAD

Reputation: 4919

@joey

This worked for me:

The solution is to return NO from accessibilityScroll

- (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction
{
    return NO;
}

Now your tableview should stop scrolling when disabled

Upvotes: 2

Related Questions