[英]UIScrollview paging issue
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. 我有一个启用了分页的UIScrollView ,我的目标是检测用户是否通过滑动到达第三页,我想将用户重定向到另一个视图。 I have tried many ways.
我尝试了很多方法。 tried it in scrollViewWillBeginDragging , tried inbuilt pan gesture in scrollview methods using handleSwipeGesture .
在scrollViewWillBeginDragging中尝试过,在handleView方法中使用handleSwipeGesture尝试了内置平移手势。 But unfortunately nothing worked.
但不幸的是没有任何效果。 Can any body please tell me how to face this issue.
谁能告诉我如何面对这个问题。 Thanks in advance.
提前致谢。
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.
条件将重定向到指定的视图。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.