PresentViewController switch interface, viewcontroller Switch

Source: Internet
Author: User

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

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.