How to get references to some particular views in animateTransition:

I would like to make a custom view controller transition using an animator oject. Problem is I don't have the references to some particular views (in both VC) I also want to animate. Maybe I sould simply typecast both VC references I get from transitionContext in animateTransition:? Or maybe it's not the right way to to what I want to do?


Thanks!!!

Replies

How can I get my view controller to be notified that a transition is about to take place so I can use animateAlongsideTransition:completion:


Where there is a size change, there is viewWillTransitionToSize:withTransitionCoordinator but I can't find sometime for my case. Something like viewWillTransition:withViewCoordinator.


Creating Animations that Run Alongside a Transition


View controllers involved in a transition can perform additional animations on top of any presentation or transition animations. For example, a presented view controller might animate its own view hierarchy during the transition and add motion effects or other visual feedback while the transition occurs. Any object can create animations, as long as it is able to access the

transitionCoordinator
property of the presented or presenting view controller. The transition coordinator exists only while a transition is in progress.


To create animations, call the

animateAlongsideTransition:completion:
or
animateAlongsideTransitionInView:animation:completion:
method of the transition coordinator. The blocks you provide are stored until the transition animations begin, at which point they are executed along with the rest of the transition animations.

Using animateAlongsideTransition:completion: in viewWillAppear: and/or viewWillDisappear: seems the way go.