Search code examples
iosobjective-canimationcore-animationuipageviewcontroller

UIPageViewController's viewController subview animation on transition


Is there a way to animate UIPageViewController's viewController subview on transition?

E.g.: I have set UIPageViewController's transition style to Scroll, navigation to Horizontal and spine location to the bottom of the screen.

Each viewController of UIPageViewController has a label which I want to fade-in or fade-out on transition.

Fade-in and Fade-out on transition

It is possible to achieve non-animated result by implementing <UIPageViewControllerDelegate> protocol. Is it possible to animate the opacity of a label relatively to gesture?


Solution

  • Unfortunately, it's not. The delegate doesn't provide any means to get the scroll position. You'll have to roll your own version of UIPageViewController (for example, using a UIScrollView and listen for the scrollViewDidScroll: and other delegate methods)