この動作については、レーダーにバグが報告されています。したがって、Apple が修正するまで、これを解決する機会はないと思います。
One workaround that comes to my mind is laying a transparent subview on top of your UIPageViewController
and add to it a UIPanGestureRecognizer
to intercept that kind of gesture and not forward further. You could enable this view/recognizer when disabling the gesture is required.
I tried it with a combination of Pan and Tap gesture recognizers and it works.
This is my test code:
- (void)viewDidLoad {
[super viewDidLoad];
UIPanGestureRecognizer* g1 = [[[UIPanGestureRecognizer alloc] initWithTarget:self
action:@selector(g1Pan:)] autorelease];
[self.view addGestureRecognizer:g1];
UITapGestureRecognizer* s1 = [[[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(g1Tap:)] autorelease];
[self.view addGestureRecognizer:s1];
UIView* anotherView = [[[UIView alloc]initWithFrame:self.view.bounds] autorelease];
[self.view addSubview:anotherView];
UIPanGestureRecognizer* g2 = [[[UIPanGestureRecognizer alloc] initWithTarget:self
action:@selector(g2Pan:)] autorelease];
[anotherView addGestureRecognizer:g2];
}
When g2
is enabled, it will prevent g1
from being recognized. On the other hand, it will not prevent s1 from being recognized.
I understand this is hack, but in the face of a seeming bug in UIPageViewController
(at least, actual behavior is blatantly different from what the reference states), I cannot see any better solution.