我看到我可以删除所有UIPageViewController手势,但是如果我只想删除边缘上的点按手势呢?并保持滑动手势?这可能吗?
由于
答案 0 :(得分:34)
尝试循环浏览pageViewController.gestureRecognizers
,禁用任何点击识别器。
目标-C:
for (UIGestureRecognizer *recognizer in pageViewController.gestureRecognizers) {
if ([recognizer isKindOfClass:[UITapGestureRecognizer class]]) {
recognizer.enabled = NO;
}
}
夫特:
for recognizer in pageViewController.gestureRecognizers {
if recognizer is UITapGestureRecognizer {
recognizer.isEnabled = false
}
}
答案 1 :(得分:1)
如果您需要在Swift中执行此操作:
for recognizer in pageViewController.gestureRecognizers as! [UIGestureRecognizer] {
if recognizer is UITapGestureRecognizer {
recognizer.enabled = false
}
}
答案 2 :(得分:0)
SWIFT 4.2 添加到viewDidLoad()
for recognizer in self.gestureRecognizers {
if recognizer is UITapGestureRecognizer {
recognizer.isEnabled = false
}
}