This article refers to: http://www.cnblogs.com/kenshincui/p/3972100.html#autoid-3-0-0 summary:
Effect:
Transition Animationsis to transition from one scene to another in an animated form. The use of transition animations is generally divided into the following steps:
1. Create a transition animation catransition
2. Set the transition type Transtion.type, subtype Transtion.subtype (optional), and other properties
3. Set a new view after the transition and add animations to the layer
The following table lists the commonly used transition types (note that the private API is an animation type that is not publicly available by Apple, but is still accessible by now):
*
Public API
* Fade fade Out effect Kcatransitionfade
Movein new view moves to the old view Kcatransitionmovein
Push new view exits the old view Kcatransitionpush
Reveal move old view to show new View Kcatransitionreveal
the private API
Cube Stereo Flip Effect
Oglflip Rollover Effect
Suckeffect Shrinkage Effect
Rippleeffect Droplet Ripple Effect
Pagecurl PAGE UP effect
Pageuncurl PAGE DOWN effect
Cameralirishollowopen Camera Open Effect
Camerairishollowclose Camera off effect
transitionviewcontroller.m//cakeyframeanimation////Created by the Emperor Phlogistic Demon on 16/5/26.//copyright©2016 year Emperor Phlogistic demon. All rights reserved.//#import "TransitionViewController.h" #define Image_count 10@interface Transitionviewcontroller ( ) {Uiimageview *_imageview; int _currnetindex;} @end @implementation transitionviewcontroller-(void) viewdidload {[Super viewdidload]; Self.view.backgroundColor = [Uicolor Whitecolor]; Define picture Space _imageview = [[Uiimageview alloc] init]; _imageview.frame = CGRectMake (0, 0, self.view.bounds.size.width, self.view.bounds.size.height); _imageview.contentmode = Uiviewcontentmodescaleaspectfit; _imageview.image = [UIImage imagenamed:@ "Fish0"]; [Self.view Addsubview:_imageview]; Add gesture Uiswipegesturerecognizer *left = [[Uiswipegesturerecognizer alloc] initwithtarget:self action: @selector (LEFTSW IPE)]; Left.direction = Uiswipegesturerecognizerdirectionleft; [Self.view Addgesturerecognizer:left]; UiswipegesTurerecognizer *right = [[Uiswipegesturerecognizer alloc] initwithtarget:self action: @selector (Rightswipe)]; [Self.view Addgesturerecognizer:right]; Do any additional setup after loading the view.} #pragma mark----left sweep gesture-(void) leftswipe{[self transitionanimation:yes];} #pragma mark---Right sweep gesture-(void) rightswipe{[self transitionanimation:no];} #pragma mark---transition animation/** * Transition animation is the transition from one scene to another in an animated form. The use of transition animations is generally divided into the following steps: 1. Create transition Animations Catransition 2. Set the transition type Transtion.type, subtype Transtion.subtype (optional), and other properties 3. Set a new view after the transition and add animations to the layer The following table lists the commonly used transition types (note that the private API is not publicly available for Apple, but is still accessible by default): * Exposed API * Fade fade effect Kcatransitionfade Movein New view moved to Old view Kcatransi Tionmovein push new view exits old view Kcatransitionpush reveal move old view Show New view Kcatransitionreveal private API Cube Stereoscopic Flip effect Oglfli P Flip Effect suckeffect shrinkage effect rippleeffect droplet ripple effect Pagecurl page Up effect pageuncurl PAGE Down effect cameralirishollowopen camera open effect Camerairishollowclose camera off effect */-(void) Transitionanimation: (BOOL) isnext{//1. Create a transition moveDraw object Catransition *transtion = [[Catransition alloc] init]; Set the animation type to use only the string transtion.type = @ "Camerairishollowclose"; Set subtype if (Isnext) {transtion.subtype = Kcatransitionfromright; }else {transtion.subtype = Kcatransitionfromleft; }//Set animation time Transtion.duration = 1.0; Set the transition animation after the new view is added _imageview.image = [self getimage:isnext]; [_imageview.layer addanimation:transtion forkey:@ "Kctransitionanimation"];} -(UIImage *) GetImage: (BOOL) isnext{if (isnext) {_currnetindex = (_currnetindex + 1)%image_count; }else{_currnetindex = (_currnetindex-1 + image_count)%image_count; } nsstring *imagename = [NSString stringwithformat:@ "fish%i", _currnetindex]; return [UIImage Imagenamed:imagename]; }-(void) didreceivememorywarning {[Super didreceivememorywarning]; Dispose of any resources the can be recreated.} /* #pragma mark-navigation//in a storyboard-based appLication, you'll often want to do a little preparation before navigation-(void) Prepareforsegue: (Uistoryboardsegue *) seg UE sender: (ID) Sender {//Get the new view controller using [Segue Destinationviewcontroller]. Pass the selected object to the new view Controller.} */@end
IOS coreanimation Transition Animation catransition