UIPageViewController Traps All UITapGestureRecognizer Events

It was a long day on the keyboard, so I turn to :-)

I have UIPageViewControllerin a typical implementation that basically matches Apple standard templates. I am trying to add an overlay that will allow the user to do something like clicking a button to go to certain pages or remove the view controller to go to another part of the application.

My problem is that it UIPageViewControllercaptures all the events from my overlay subclass, and I'm struggling to find a workable solution.

Here is sample code to help you ...

In the DidLoad view

// Page creation, pageViewController creation etc....

self.pageViewController.delegate = self;

[self.pageViewController setViewControllers:pagesArray
                                  direction:UIPageViewControllerNavigationDirectionForward
                                   animated:NO
                                completion:NULL];

self.pageViewController.dataSource = self;

[self addChildViewController:self.pageViewController];
[self.view addSubview:self.pageViewController.view];

// self.overlay being the overlay view

if (!self.overlay) 
{
   self.overlay = [[MyOverlayClass alloc] init];  // Gets frame etc from class init
   [self.view addSubview:self.overlay];
}

. , UIPageViewController, . , - , .

UIButtons self.overlay . UIPageViewController .

-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch .

UIPageViewController

- (, , ).

- , , , UIPageViewController.

!

+5
2

UIPageViewController.GestureRecognizers self

-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch;

:

In viewDidLoad

for (UIGestureRecognizer * gesRecog in self.pageViewController.gestureRecognizers)
{
        gesRecog.delegate = self;
}

:

-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
    if (touch.view != self.pageViewController.view]
    {
        return NO;
    }
    return YES;
}
+3

UIPageViewController , dataSource. , , , .

, setViewControllers:direction:animated:completion, .

Apple UIPageViewController (, ):

, , .

0

All Articles