Detailed IOS layer Transitions animation _ios

Source: Internet
Author: User

A subclass of Caanimation that is used to animate transitions, providing layers with animations to move out of the screen and move into the screen. iOS has less effect than Mac OS x transitions
Uinavigationcontroller is the animation effect of pushing the controller's view into the screen through catransition
Attribute resolution:

    • Type: Animation transition types
    • Subtype: Animation transition Direction
    • Startprogress: Animation starting point (percentage of overall animation)
    • Endprogress: Animation Endpoint (percentage of overall animation)

Specific code:

/* Transition effect fade//cross-fade transition (not supported in transition direction) Kcatransitionfade push//New view push old view out Kcatransitionpush Movein//New view move to Old view Kcatran Sitionmovein reveal//move the old view away, showing the new view below Kcatransitionreveal cube//Cube Rollover effect oglflip///Flip effect suckeffect//shrink effect, such as a piece of cloth Removed (not supported in transition direction) Rippleeffect//dripping effect (does not support transition direction) Pagecurl//Page UP effect pageuncurl//Page DOWN effect camerairishollowopen//Camera lens open effect (not supported Transition direction) Camerairishollowclose//Camera lens closing effect (does not support the transition direction)/* Transition Direction kcatransitionfromright Kcatransitionfromleft Kcatransiti Onfrombottom//Transitions Animation--"ViewController.h" is an animated animation for a view's layer #import the #import <QuartzCore/QuartzCore.h> @
  Interface Viewcontroller () {UIView *_lastview;
BOOL Flag;
  @end @implementation Viewcontroller-(void) viewdidload {[Super viewdidload];
  Flag=true;
  UIView *view=[[uiview Alloc] initwithframe:cgrectmake (100, 100, 200, 200)];
  View.backgroundcolor=[uicolor Redcolor];
  [Self.view Addsubview:view];
  [View release];
  _lastview=view; Do no additional setup after loading the VIEW, typically from a nib. }-(void) Touchesbegan: (Nsset *) touches withevent: (uievent *) event{if (flag) {_lastview.backgroundcolor=[uicolor Yel
    Lowcolor];
  
  Flag=false;
    } else{_lastview.backgroundcolor=[uicolor Redcolor];
  Flag=true;
  //Transitions Animation--that is, animating a view.
  1: If the switch between the controller, in fact, window view to switch catransition *transion=[catransition animation];
  Sets the type of transition animation transion.type=@ "Pagecurl";
  
  Set the direction of the transition animation transion.subtype=@ "Fromleft";
  
Add animation to a view layer [Self.view.layer addanimation:transion forkey:nil];

 }

The controller switches the animation directly

 UIApplication *app=[uiapplication sharedapplication];
  Appdelegate *dd=app.delegate;
  
    Myviewcontroller *my=[[myviewcontroller alloc] init];
  Toggle the root controller, in fact, the view controller to switch views on the window. So in the transition animation to function on window
  dd.window.rootviewcontroller=my;
  Catransition *trans=[catransition animation];
  
  trans.type=@ "Pagecurl";
  trans.subtype=@ "Fromtop";
  
  [Dd.window.layer Addanimation:trans Forkey:nil];
  
  [My release];

The above is the entire content of this article, I hope to help you learn.

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.