Is it possible to get hold of the transitionCoordinator
of a UIPageViewController
?
Every time I try to get it it's nil
. Does it even use one?
If not, is there a non-hacky way of responding to the progress of a scroll between pages?
(hacky = iterating subviews to get scroll view and becoming scroll view delegate. This isn't ideal because of the "magic" that UIPageViewController
does with its scroll view)
Thanks
After years of experimentation, I have never found a situation in which the transitionCoordinator
of a UIPageViewController is not nil
.
And, as Fogmeister points out in this original question and comments, there is also therefore no good way to track the page view controller scroll animation and coordinate with it.
My solution is to roll my own paging scroll view that does what UIPageViewController does, i.e. it preloads the page views before and after this one, but no others, so that memory is conserved. Now we have an ordinary scroll view, we can serve as its delegate, and we can do anything we like in connection with the scroll.
It isn't all that difficult, and is in fact what we used to do before there was a UIPageViewController (yes, I remember those days well).
Apple even provides an example of how to do it: https://developer.apple.com/library/archive/samplecode/PageControl/Introduction/Intro.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With