我将 UIPageViewController 子类化,然后放这个:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
PO(self.gestureRecognizers);
PO(self.view.gestureRecognizers);
PO(self.view.superview.gestureRecognizers);
}
我有:
self.gestureRecognizers: (
"<UIPanGestureRecognizer: 0x137edf20; state = Possible; view = <_UIPageViewControllerContentView 0x137efe10>; target= <(action=_handlePanGesture:, target=<BGPageViewControllerWithoutTap 0x137659a0>)>>",
"<UITapGestureRecognizer: 0x137ef520; state = Possible; view = <_UIPageViewControllerContentView 0x137efe10>; target= <(action=_handleTapGesture:, target=<BGPageViewControllerWithoutTap 0x137659a0>)>>"
)
2013-08-15 13:03:26.428 isikota[6213:c07] self.view.gestureRecognizers: (
"<UIPanGestureRecognizer: 0x137edf20; state = Possible; view = <_UIPageViewControllerContentView 0x137efe10>; target= <(action=_handlePanGesture:, target=<BGPageViewControllerWithoutTap 0x137659a0>)>>",
"<UITapGestureRecognizer: 0x137ef520; state = Possible; view = <_UIPageViewControllerContentView 0x137efe10>; target= <(action=_handleTapGesture:, target=<BGPageViewControllerWithoutTap 0x137659a0>)>>"
)
2013-08-15 13:03:26.428 self.view.superview.gestureRecognizers: (null)
现在我确保我的 UIPageViewController 处于滚动模式而不是页面卷曲模式,这就是我得到的:
2013-08-15 13:14:38.362 [6767:c07] self.gestureRecognizers: (
)
2013-08-15 13:14:38.362 [6767:c07] self.view.gestureRecognizers: (null)
2013-08-15 13:14:38.362 [6767:c07] self.view.superview.gestureRecognizers: (null)
因为gestureRecoqnizers 是空的,所以我不能做任何事情来禁用它。例如,我不能禁用点击手势识别器以允许在 UIPageViewController 内点击按钮。
所以我该怎么做?