Using Uipresentationcontroller to customize transitions in iOS8

Source: Internet
Author: User

1, Uipresentationcontroller Introduction

Uipresentationcontroller is a new API for iOS8 to control the jump effects between controllers. For example, to implement a special effect, display a window, size and position are customized, and mask on the original page. Before, there are some ways to manipulate the view to implement.

2. Introduction of Use

1. Set the transition agent and presentation method for the target controller

Controller.modalpresentationstyle = uimodalpresentationstyle.custom//Set animation style Controller.transitioningdelegate = transtinodelegate//This object to implement the Uiviewcontrollertransitioningdelegate protocol

2. Transtiondelegate implementation Uiviewcontrollertransitioningdelegate Protocol Method

Returns the object of the control controller popup animation optional func Animationcontrollerforpresentedcontroller (Presented:uiviewcontroller, Presentingcontroller Presenting:uiviewcontroller, Sourcecontroller Source:uiviewcontroller) uiviewcontrolleranimatedtransitioning?//returns the object that controls the controller disappears animation optional func Animationcontrollerfordismissedcontroller ( Dismissed:uiviewcontroller)-uiviewcontrolleranimatedtransitioning @availability (IOS, introduced=8.0)// Returns the object of the control controller jump optional func presentationcontrollerforpresentedviewcontroller (Presented:uiviewcontroller, Presentingviewcontroller presenting:uiviewcontroller!, Sourceviewcontroller Source:uiviewcontroller) Uipresentationcontroller?

3. Control the class of the controller jump

Class of control controller jump inherits from Uipresentationcontroller

/* Construction Method: Parameter: Presentedviewcontroller the target controller to jump to Presentingviewcontroller the original controller */init before jumping (presentedviewcontroller: uiviewcontroller!, presentingviewcontroller:uiviewcontroller!)

Common Properties and methods
Presentedviewcontroller: View controller to modal display Presentingviewcontroller: Low-level View Controller Containerview () container view Presentedview () The displayed view func presentationtransitionwillbegin () jump will begin with Func presentationtransitiondidend (completed:bool) Jump completion func Dismissaltransitionwillbegin () dismiss will begin Func Dismissaltransitiondidend (completed:bool) dismiss complete func Frameofpresentedviewincontainerview () Target Controller settings

4. Controlling Animation Classes

Control animations inherit from Uiviewcontrolleranimatedtransitioning for classes

Time to perform animation func transitionduration (transitioncontext:uiviewcontrollercontexttransitioning), nstimeinterval// Animation Process setup Func animatetransition (transitioncontext:uiviewcontrollercontexttransitioning)

5. Summary

1. Set the transition agent for the target controller

2. The session agent returns three objects for controlling the transition process

3. Control the Controller transition object, you can do the operation before and after the session, such as adding masks, etc.

4. Control transition Animation, which sets the animation that the target controller appears or disappears, as well as the size style of the controller.

3. Detailed description of the API

Later...

4. Custom Jump Demo

Later...


Using Uipresentationcontroller to customize transitions in iOS8

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.