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.