IOS development-custom transfer animation and ios custom transfer Animation

Source: Internet
Author: User

IOS development-custom transfer animation and ios custom transfer Animation
The first is UIPresentationController. This controller provides modal's new viewController with the next step of view and transfer management, from modal viewController to dismiss, UIPresentationController is used to manage all aspects of the View display process. You can add custom animations, respond to changes in the size, and manage how other viewcontrollers are displayed on the screen. During initialization, override initWithPresentedViewController: presentingViewController: This method, initialize and return a presentationController to convert the two views.containerViewThis read-only attribute is the view where the rendered view is located. We can add other views to this view by using the insertSubview (dummyView, atIndex: 0) method. Next, we will use two proxies: UIViewControllerTransitioningDelegate and UIViewControllerAnimatedTransitioning to implement the proxy method. isPresented is a flag for rendering.

// Return the Controller object func presentationControllerForPresentedViewController (presented: UIViewController, presentingViewController presenting: UIViewController, sourceViewController source: UIViewController)-> UIPresentationController? {Return parameters (presentedViewController: presented, presentingViewController: presenting)} // return the func animation (presented: UIViewController, presentingController presenting: UIViewController, sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? {IsPresented = true return self} // returns the func animationControllerForDismissedController (dismissed: UIViewController) object that provides the dismiss animation-> UIViewControllerAnimatedTransitioning? {IsPresented = false return self} // animation duration func transitionDuration (transitionContext: UIViewControllerContextTransitioning ?) -> NSTimeInterval {return 1.2} // transfer animation implementation function func animateTransition (transitionContext: UIViewControllerContextTransitioning ){}


In the last method, the animation process is implemented. In addition, you must set
// Set the transfer animation agent vc. transitioningDelegate = self // set the transfer animation to Custom vc. modalPresentationStyle = UIModalPresentationStyle. Custom


Otherwise, the transition animation cannot be customized.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.