我有一个 viewController
继承自 UIPageViewController
( @interface PageScrollViewController : UIPageViewController
) 现在我想知道如何启用和禁用从 UIPageViewController
滚动?使用 UIScrollView
时,您会执行 setScrollEnabled:NO
并且 self.view.userInteractionEnabled = NO;
不是一个选项,因为这会阻止整个UIView
而不仅仅是滚动。
编辑
这是在 PageScrollViewController : UIPageViewController
类中:
if ([[notification name] isEqualToString:@"NotificationDisable"]){
NSLog (@"Successfully received the disable notification!");
for (UIGestureRecognizer *recognizer in self.gestureRecognizers) {
recognizer.enabled = NO;
}
}
最佳答案
或者您可以在 PagingVC 中转换以禁用分页:
self.delegate = nil;
self.dataSource = nil;
再次启用它:
self.delegate = self;
self.dataSource = self;
关于iphone - 在 UIPageViewController 中禁用/启用滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15829197/