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