[英]Disable and Reenable Page View Controller gesture recogniser?
I have a page view controller that the user can swipe between views. 我有一个页面视图控制器,用户可以在视图之间滑动。
I want to stop the user from being able to swipe between the views ridiculously fast by temporarily disabling then reenabling the page view controller gesture recogniser. 我想通过暂时禁用然后重新启用页面视图控制器手势识别器,来阻止用户快速在视图之间疯狂地滑动。
How can I programmatically disable and reenable the page view controllers gestures recogniser? 如何以编程方式禁用和重新启用页面视图控制器手势识别器?
Here is an example of something I am ideally trying to do. 这是我理想地尝试做的事的一个例子。
- (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed
{
enableSwiping = NO;
}
I don't think UIPageViewController has an API to do that sort of thing but by returning only a subset of views from the data source method you can achieve the required behaviour. 我认为UIPageViewController没有API可以执行此类操作,但是通过仅从数据源方法返回视图的子集,您可以实现所需的行为。
Take a look at this question on SO which talks about disabling scrolling for page View controller Disable Page scrolling in UIPageViewController 看看SO上的这个问题,它讨论了禁用页面View Controller的滚动禁用UIPageViewController中的页面滚动
So for your requirement you should only return say the first two pages until the user scrolls till second page. 因此,根据您的要求,您只应返回说前两页,直到用户滚动到第二页为止。 Then you can return the next two pages....
然后,您可以返回下两页...。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.