1

I tried this solution:

UIButton interaction inside UIPageViewController

It says I should set delegate UIPageViewController gesture recoqnizer. But it returns zero.

For example, if I subclass of UIPageViewController and in viewDidload I do this:

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

}

I got:

self.gestureRecognizers: (
)
self.view.gestureRecognizers: (null)

Hence, I cannot set delegate for the UIPageViewController's gesture recoqnizers because I can't have a pointer to it. But that UIPageViewController absorb all taps that my button doesn't get pressed. So what should I do?

I tried many solutions from various similar questions in stack overflow. It all fails.

This is a simple problem. I have a UIButton inside a UIPageViewController. Why it has be to be this difficult?

What is the delegate of UIPageViewController's gesture recoqnizers anyway?

Also UIPageViewController doesn't have rootViewController and I am very confused why people say it has.

Community
  • 1
  • 1
Septiadi Agus
  • 1,775
  • 3
  • 17
  • 26

1 Answers1

0

Show us, how do you subclass UIPageViewController.

This works at least:

  UIPageViewController *pageVC = [[UIPageViewController alloc] init];
  NSLog(@"%@", pageVC.gestureRecognizers);

This controller has gestureRecognizers property for sure:

enter image description here

Denis Kutlubaev
  • 15,320
  • 6
  • 84
  • 70
  • Is your UIPageViewController in scroll mode rather than page curl mode? – Septiadi Agus Aug 15 '13 at 07:47
  • This is my sample code, I just tried to check what you tell. I didn't change default mode. I guess, it should work in both modes for a root class (not subclasses) according to the documentation - no notes on that. – Denis Kutlubaev Aug 15 '13 at 07:59
  • Yes, by default the transition style is page curl. So, you are right. When I tried to init it with a transition style scroll, it didn't have recognizers. So, the problem is not in subclassing. Looks like in that mode it doesn't work. – Denis Kutlubaev Aug 15 '13 at 08:05
  • Well, how do I turn off the tap gestureRecoqnizers if I cannot access the gestureRecoqnizers? I want buttons inside the UIPageViewController to work. – user4951 Aug 22 '13 at 06:01