Septiadi Agus
Septiadi Agus

Reputation: 1775

Why gesture recoqnizers are empty when UIPageViewController is in scroll mode

I subclasses UIPageViewController and I put this:

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    PO(self.gestureRecognizers);
    PO(self.view.gestureRecognizers);
    PO(self.view.superview.gestureRecognizers);

}

I got:

 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)

Now I make sure that my UIPageViewController is in scroll mode rather than page curl mode and this is what I got:

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)

Because the gestureRecoqnizers are null I cannot do anything to disable it. I cannot, for example, disable the tap gesture recoqnizer to allow button taps inside the UIPageViewController.

So what should I do?

Upvotes: 1

Views: 582

Answers (1)

Dong Ma
Dong Ma

Reputation: 1073

command+tap the keyword gestureRecognizers and jump to the source code, the comment line says:

// 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'

So in scrolling mode, no surprise, this is empty

I came to this today. What I'm having is a UIPageViewController with several UITableViews inside, but the UITalbeView cannot get the tap gesture (the didSelectRowAtIndexPath of the UITableView delegate is NOT fired).

I'm searching for a solution now and found this post. I can answer the Agus's question, but have no idea of mine...

Upvotes: 1

Related Questions