Custom Transition Summary

来源:互联网 发布:python exit code 137 编辑:程序博客网 时间:2024/06/10 09:33

After a long time learning custom transition, I finally got the hang of the general processes which are a little complicated for a freshman. In my opinion, the main idea is using delegate to implement the whole custom transition, which means that the priority of starting to learn this knowledge is making sure you understand how delegate works. Otherwise, it may be difficult to understand the whole procedures.


First of all is introducing a most important element, i.e. Transition Delegate which provides the Animator, Interactive Animator and Presentation Controller, all of which are created and implemented by yourself. The Figure below from Apple Documentation illustrates the whole structure.



Essentially, Animator is an object conforming UIViewControllerAnimatedTransitioning protocol. This element provided by developers implements how a "fromView" transition to a specific position in the screen with your custom animation.

Interactive Animator is an object, which can inheritUIPercentDrivenInteractiveTransition, providing gesture disposal. The updateInteractiveTransition: method tell the UIKit how the animator implemented by the former Animator is getting close to the end animator state.

Presentation Controller aims to provide other animation during the whole transition and add another views into the view hierarchy. If you want to custom presentation model by offering this presentation controller in the transition delegate, you have to make sure the presentation model of your presented view controller is set to ***Custom. Otherwise, it does not work as desired.


In summary, if you are getting sick of provided transition and gonna implement custom transition, you have to take the following attention into account.

1. Providing transition delegate to the presented VC

2. Set presentation model to **Custom if needed.


 




0 0
原创粉丝点击