Thizzer
Thizzer

Reputation: 16653

Lock UIScrollView on specific page (pagingEnabled)

I have a UIScrollView with paging enabled, and that works fine.

Now I want to 'lock' the UIScrollView on a specific page, prevent the user from scrolling to the next or previous page. How would I go about this?

Upvotes: 0

Views: 1168

Answers (2)

relower
relower

Reputation: 1313

- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
   if(currentPage == 4)
      [scrollView setScrollEnabled:NO]; // when the page is "4", scroll will be locked
//or
   [scrollView setUserInteractionEnabled:false];    
}

Upvotes: 1

jbat100
jbat100

Reputation: 16827

You could just disable the interaction

scrollView.interactionEnabled = NO;

Unless you want interaction within that page?

Upvotes: 0

Related Questions