博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
COCOA的UIVIEW动画护展
阅读量:5989 次
发布时间:2019-06-20

本文共 2144 字,大约阅读时间需要 7 分钟。

hot3.png

#import "UIViewAnimation.h"

@implementation UIView (UIView_Animation)

- (void)transition:(UIView *)view1 

             view2:(UIView *)view2 

              type:(NSInteger)type 

           subType:(NSInteger)subType {

CATransition *transition = [CATransition animation];

    transition.delegate = self;

transition.duration = 0.45;

transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];

    transition.fillMode = kCAFillModeForwards;

transition.endProgress = 1;//slider.value;

transition.removedOnCompletion = NO;

NSString *types[12] = {

kCATransitionPush,kCATransitionMoveIn, kCATransitionReveal, kCATransitionFade,@"cube",@"suckEffect",@"oglFlip",@"rippleEffect",@"pageCurl",@"pageUnCurl",@"cameraIrisHollowOpen ",@"cameraIrisHollowClose "};

NSString *subtypes[4] = {

kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom};

transition.type = types[type];

    transition.subtype = subtypes[subType];

    [self.layer addAnimation:transition forKey:@"animation"];

view1.hidden = YES;

view2.hidden = NO;

}

- (void)viewAnimation:(NSInteger)index 

                view1:(UIView *)view1 

                view2:(UIView *)view2 

{

[UIView beginAnimations:@"animationID" context:nil];

[UIView setAnimationDuration:0.45f];

[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

[UIView setAnimationRepeatAutoreverses:NO];

switch (index) {

case :

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self cache:YES];//oglFlip, fromLeft 

break;

case 1:

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self cache:YES];//oglFlip, fromRight  

break;

case 2:

[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self cache:YES];

break;

case 3:

[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self cache:YES];

break;

default:

break;

}

view1.hidden = YES;

view2.hidden = NO;

    [UIView commitAnimations];

}

- (void)popup:(CGRect)rect {

    

[UIView beginAnimations:nil context:nil];

[UIView setAnimationDuration:0.2];

[UIView setAnimationCurve:UIViewAnimationCurveLinear];

[self setFrame:rect];

[UIView commitAnimations];

}

@end

转载于:https://my.oschina.net/ahuaahua/blog/30621

你可能感兴趣的文章
1分钟搭建属于你的DNS服务器
查看>>
xtrabackup备份还原(十一)
查看>>
Css不常用属性的使用
查看>>
?? [SQL Server] -- Using FILESTREAM to Store BLOBs in the NTFS File System in SQL Server 2008
查看>>
我的友情链接
查看>>
go中iota的用法
查看>>
工厂模式
查看>>
Nginx负载均衡 大全
查看>>
运维管理平台 基于jumperserver 二次开发
查看>>
rsync 错误与解决方案收集 .
查看>>
html本地存储
查看>>
Exchange 2013与OWA13集成
查看>>
分页原理4
查看>>
网络传输安全SSL/TLS
查看>>
P2P控制流量教程
查看>>
OTNM200客户端安装
查看>>
我的友情链接
查看>>
iOS开发tableView去掉顶部上部空表区域
查看>>
windows常用快捷键
查看>>
CentOS (RHEL) 系统管理中的查看内存插槽数、最大容量和频率
查看>>