I have a UIPageViewController
embedded in a UIScrollView
and each page has a drawing view with a UIPanGestureRecognizer
to free-draw. With this setup, the 1st time I attempt to draw, the pan gesture is ignored. It works the 2nd time I perform the gesture.
In my case I need to wrap the UIPageViewController in a UIScrollView to have a pull to refresh mechanism (set thescrollView.refreshControl
).
I’ve tried every combination of UIGestureRecognizerDelegate methods (shouldRecognizeSimultaneously…, require(toFail:), etc.) with no luck.
This is my view hierarchy:
ScrollView
|- UIPageViewController
|- Page 1
| |- DrawingView with UIPanGestureRecognizer
|- Page 2
|- DrawingView with UIPanGestureRecognizer
Is this a known limitation when a UIPageViewController is nested inside another scroll view?
Reproduction steps (tested on iOS 18.4 / Xcode 16.3, iPhone 16 Pro)
- Launch the app; the first page shows a white canvas in the bottom part.
- Try to draw immediately → nothing happens.
- Lift your finger and draw again → works.
Here is a link for the sample project with the reproducible code: https://github.com/marcod-storyteller/page-controller-sample
P.S: If the UIPageViewController
has a .pageCurl
transition style instead, the problem disappears.