1

我将 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 内点击按钮。

所以我该怎么做?

4

1 回答 1

1

命令+点击关键字gestureRecognizers并跳转到源代码,注释行说:

// An array of UIGestureRecognizers pre-configured to handle user interaction. Initially attached to a view in the UIPageViewController's hierarchy, they can be placed on an arbitrary view to change the region in which the page view controller will respond to user gestures.
// Only populated if transition style is 'UIPageViewControllerTransitionStylePageCurl'

所以在滚动模式下,毫不奇怪,这是空的

我今天来了。我所拥有的是一个内部有几个 UITableViews 的 UIPageViewController,但 UITalbeView 无法获得点击手势(未触发 UITableView 委托的 didSelectRowAtIndexPath )。

我现在正在寻找解决方案并找到了这篇文章。我可以回答阿古斯的问题,但不知道我的...

于 2014-07-01T08:53:04.797 回答