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

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.