PresentViewController switch interface, viewcontroller Switch
When no NavigationController is available, presentViewController is usually used to switch the view and carry the animation during the switchover,
The switchover method is as follows:
-PresentViewController: animated: completion: displayed. A new view can have an animation effect. After completion, the corresponding execution function is often nil.
-DismissViewControllerAnimated: completion
You can use the switch animation when it is pushed into a new view or a top-level view. The following uses the push in view as an example.
PresentModalViewController: animated: completion: Use the four types of animations that come with the system.
Simple implementation:
[Page2Controller setModalTransitionStyle: UIModalTransitionStyleFlipHorizontal];
[Self presentModalViewController: myNextViewController animated: YES completion: nil];
Four types of animations supported by the system:
Typedef enum {
UIModalTransitionStyleCoverVertical = 0, // default mode, vertical push up
UIModalTransitionStyleFlipHorizontal, // horizontal reversal
UIModalTransitionStyleCrossDissolve, // hide
UIModalTransitionStylePartialCurl, // partial paging Effect
} UIModalTransitionStyle;
PresentModalViewController: animated: completion: no built-in animation Effects
Achieve full page turning:
CATransition * animation = [CATransition animation];
Animation. duration = 1.0;
Animation. timingFunction = UIViewAnimationCurveEaseInOut;
Animation. type = @ "pageCurl ";
// Animation. type = kCATransitionPush;
Animation. subtype = kCATransitionFromLeft;
[Self. view. window. layer addAnimation: animation forKey: nil];
[Self presentModalViewController: myNextViewController animated: NO completion: nil];
The typical sequence operator type ):
KCATransitionFade // fade out
KCATransitionMoveIn // overwrite the source Image
KCATransitionPush // release
KCATransitionReveal // display at the bottom
SubType:
KCATransitionFromRight
KCATransitionFromLeft // Default Value
KCATransitionFromTop
KCATransitionFromBottom
Method for setting other animation types (type ):
PageCurl page up
PageUnCurl flip down one page
RippleEffect dripping Effect
SuckEffect contraction effect, such as a piece of cloth being extracted
Cube Effect
OglFlip flip up and down
-
Top
-
2