Reputation: 538
I have a UIScrollView with paging enabled, my goal is to detect if the user reaches third page by swiping, I want to redirect the user to another view. I have tried many ways. tried it in scrollViewWillBeginDragging , tried inbuilt pan gesture in scrollview methods using handleSwipeGesture . But unfortunately nothing worked. Can any body please tell me how to face this issue. Thanks in advance.
Upvotes: 0
Views: 69
Reputation: 46
I recommend you to use this code
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
int page=scrollview.contentoffset.x/scrollview.frame.size.width
if(page == 3)
{
// redirect to your view.
}
}
This will give you the page no. you are currently on. and the condition will redirect to a specified view.
Upvotes: 1