#pragma - mark - 切换window RootVIEwController- (IBAction)loginBtn:(UIbutton *)sender { AppDelegate* aud = (AppDelegate*)[UIApplication sharedApplication].delegate; TJTabbarController* tabVc = [[TJTabbarController alloc] init]; [UIVIEw TransitionFromVIEw:self.vIEw toVIEw:tabVc.vIEw duration:1.0f options:UIVIEwAnimationoptionTransitionFlipFromleft completion:^(BOol finished) { aud.window.rootVIEwController = tabVc; }]; } UIWindow*window= aud.window;//[UIApplication sharedApplication].keyWindow; [UIVIEw TransitionWithVIEw:window duration:1.0 options:UIVIEwAnimationoptionTransitionFlipFromleft animations:^{ //self.vIEw.transform = CGAffinetransformMakeScale(1.5,1.5); //self.vIEw.Alpha=0.8; window.rootVIEwController=aud.tab; }completion:^(BOol finished){ // [UIVIEw TransitionWithVIEw:window duration:1.0 options:UIVIEwAnimationoptionTransitionFlipFromleft animations:^// {//// } completion:^(BOol finished)// {//// }]; }];NavigationController 转场动画CATransition *animation = [CATransition animation]; //创建一个转场动画。[animation setType:@"cube"];//动画类型//animation.type = kCATransitionPush;//较常用(推出效果) //animation.type = kCATransitionReveal;//较常用(移走效果)//animation.type = kCATransitionMoveIn;//较常用 (覆盖效果)/* fademoveIn push reveal和系统的四种一样 pageCurl 向上翻一页 pageUnCurl 向下翻一页 rippleEffect 滴水效果 suckEffect 收缩效果,如一块布被抽走 cube alignedCube 立方体效果 flip alignedFlip oglFlip 翻转效果 rotate 旋转 cameraIris cameraIrisHollowOpen cameraIrisHollowClose 相机 */[animation setDuration:1.0f];//动画时间[animation setSubtype:kCATransitionFromtop]; //动画方向可设置 上 下 左 右 4个方向//在这1秒内动画是均匀的效果// [animation setTimingFunction:[camediatimingFunction functionWithname:kcamediatimingFunctionEaseInEaSEOut]]; _secondController=[SecondVIEwController new]; [self.navigationController.vIEw.layer addAnimation:animation forKey:nil]; [self.navigationController pushVIEwController:_secondController animated:YES]; //方式2:效果同上[self.navigationController.vIEw.layer addAnimation:animation forKey:@"aaa"];[self.navigationController pushVIEwController:dvc animated:NO];以动画方式推出新页面 VIEw 转场动画//// VIEwController.m// CATransition//// Created by 李泽鲁 on 14/12/12.// copyright (c) 2014年 李泽鲁. All rights reserved.//#@R_502_5552@ IMAGE1 @"01.jpg"#@R_502_5552@ IMAGE2 @"02.jpg"#@R_502_5552@ DURATION 0.7f#import "VIEwController.h"@interface VIEwController ()@property (nonatomic,assign) int subtype;@endtypedef enum : NSUInteger { Fade = 1,//淡入淡出 Push,//推挤 Reveal,//揭开 MoveIn,//覆盖 Cube,//立方体 SuckEffect,//吮吸 OglFlip,//翻转 RippleEffect,//波纹 PageCurl,//翻页 PageUnCurl,//反翻页 CameraIrisHollowOpen,//开镜头 CameraIrisHollowClose,//关镜头 CurlDown,//下翻页 CurlUp,//上翻页 FlipFromleft,//左翻转 FlipFromright,//右翻转 } AnimationType;@implementation VIEwController- (voID)vIEwDIDLoad { _subtype = 0; [super vIEwDIDLoad]; // Do any additional setup after loading the vIEw,typically from a nib. [self addBgImageWithImagename:IMAGE2];}- (IBAction)tapbutton:(ID)sender { UIbutton *button = sender; AnimationType animationType = button.tag; Nsstring *subtypestring; switch (_subtype) { case 0: subtypestring = kCATransitionFromleft; break; case 1: subtypestring = kCATransitionFromBottom; break; case 2: subtypestring = kCATransitionFromright; break; case 3: subtypestring = kCATransitionFromtop; break; default: break; } _subtype += 1; if (_subtype > 3) { _subtype = 0; } switch (animationType) { case Fade: [self TransitionWithType:kCATransitionFade WithSubtype:subtypestring ForVIEw:self.vIEw]; break; case Push: [self TransitionWithType:kCATransitionPush WithSubtype:subtypestring ForVIEw:self.vIEw]; break; case Reveal: [self TransitionWithType:kCATransitionReveal WithSubtype:subtypestring ForVIEw:self.vIEw]; break; case MoveIn: [self TransitionWithType:kCATransitionMoveIn WithSubtype:subtypestring ForVIEw:self.vIEw]; break; case Cube: [self TransitionWithType:@"cube" WithSubtype:subtypestring ForVIEw:self.vIEw]; break; case SuckEffect: [self TransitionWithType:@"suckEffect" WithSubtype:subtypestring ForVIEw:self.vIEw]; break; case OglFlip: [self TransitionWithType:@"oglFlip" WithSubtype:subtypestring ForVIEw:self.vIEw]; break; case RippleEffect: [self TransitionWithType:@"rippleEffect" WithSubtype:subtypestring ForVIEw:self.vIEw]; break; case PageCurl: [self TransitionWithType:@"pageCurl" WithSubtype:subtypestring ForVIEw:self.vIEw]; break; case PageUnCurl: [self TransitionWithType:@"pageUnCurl" WithSubtype:subtypestring ForVIEw:self.vIEw]; break; case CameraIrisHollowOpen: [self TransitionWithType:@"cameraIrisHollowOpen" WithSubtype:subtypestring ForVIEw:self.vIEw]; break; case CameraIrisHollowClose: [self TransitionWithType:@"cameraIrisHollowClose" WithSubtype:subtypestring ForVIEw:self.vIEw]; break; case CurlDown: [self animationWithVIEw:self.vIEw WithAnimationTransition:uiviewanimationtransitionCurlDown]; break; case CurlUp: [self animationWithVIEw:self.vIEw WithAnimationTransition:uiviewanimationtransitionCurlUp]; break; case FlipFromleft: [self animationWithVIEw:self.vIEw WithAnimationTransition:uiviewanimationtransitionFlipFromleft]; break; case FlipFromright: [self animationWithVIEw:self.vIEw WithAnimationTransition:uiviewanimationtransitionFlipFromright]; break; default: break; } static int i = 0; if (i == 0) { [self addBgImageWithImagename:IMAGE1]; i = 1; } else { [self addBgImageWithImagename:IMAGE2]; i = 0; } }#pragma CATransition动画实现- (voID) TransitionWithType:(Nsstring *) type WithSubtype:(Nsstring *) subtype ForVIEw : (UIVIEw *) vIEw{ //创建CATransition对象 CATransition *animation = [CATransition animation]; //设置运动时间 animation.duration = DURATION; //设置运动type animation.type = type; if (subtype != nil) { //设置子类 animation.subtype = subtype;// } //设置运动速度 animation.timingFunction = UIVIEwAnimationoptionCurveEaseInOut; [vIEw.layer addAnimation:animation forKey:@"animation"];}#pragma UIVIEw实现动画- (voID) animationWithVIEw : (UIVIEw *)vIEw WithAnimationTransition : (uiviewanimationtransition) Transition{ [UIVIEw animateWithDuration:DURATION animations:^{ [UIVIEw setAnimationCurve:UIVIEwAnimationCurveEaseInOut]; [UIVIEw setAnimationTransition:Transition forVIEw:vIEw cache:YES]; }];}#pragma 给VIEw添加背景图-(voID)addBgImageWithImagename:(Nsstring *) imagename{ self.vIEw.backgroundcolor = [UIcolor colorWithPatternImage:[UIImage imagenamed:imagename]];}- (voID)dIDReceiveMemoryWarning { [super dIDReceiveMemoryWarning]; // dispose of any resources that can be recreated.}@endVIEw Code 总结
以上是内存溢出为你收集整理的专场动画全部内容,希望文章能够帮你解决专场动画所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)