I would like to tweak the visual state of a view based on how much it is "on screen". These views are managed by a UIPageViewController, using the stock .Scroll
transition style.
The behavior I would like is to have the title be 100% opacity when it is 100% on screen and 0% opacity when it is 0% on screen, transitioning between the two as a function of the panning navigation gesture/animation.
I am hoping I can plug into the x-coordinate or a percentage animation complete, but I don't see a property anywhere. I understand the page view controller is using a scroll view behind the scenes but am a little concerned about reaching into a private API, and I don't see a public method to access it.
Is there any way to hook into the existing interactive transition so that I can add some additional behaviors to the child view controllers that scale based on the completion percentage?
Update:
- Tried implementing UIScrollViewDelegate's scrollViewDidScroll. No luck. I think page view controller does to call methods on this delegate.
- Tried using viewWillDisappear/viewDidAppear in the child view controllers. This is functional but the animation is not responsive since these are called as single events at the start/end of user behaviors.
You already update your question about UIScrollViewDelegate but, for simillary problem I use UIScrollViewDelegate like this:
in my case UIPageViewController is inside a container view controller. That's why I added a delegate (PagerDelegate) in my class to call ContainerViewController when scroll view did scrolls:
at ContainerViewController:
Hope I understand correctly and it helps someone else. (probably you fixed this problem already because asked Jun 16 '15)