/* 过渡效果
fade //交叉淡化过渡(不支持过渡方向) kCATransitionFade
push //新视图把旧视图推出去 kCATransitionPush
moveIn //新视图移到旧视图上面 kCATransitionMoveIn
reveal //将旧视图移开,显示下面的新视图 kCATransitionReveal
cube //立方体翻滚效果
oglFlip //上下左右翻转效果
suckEffect //收缩效果,如一块布被抽走(不支持过渡方向)
rippleEffect //滴水效果(不支持过渡方向)
pageCurl //向上翻页效果
pageUnCurl //向下翻页效果
cameraIrisHollowOpen //相机镜头打开效果(不支持过渡方向)
cameraIrisHollowClose //相机镜头关上效果(不支持过渡方向)
*/
/* 过渡方向
kCATransitionFromRight
kCATransitionFromLeft
kCATransitionFromBottom
//转场动画--》是针对某个view的图层进行转场动画
#import "ViewController.h"
#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 any additional setup after loading the view, typically from a nib.
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
if(flag){
_lastview.backgroundColor=[UIColor yellowColor];
flag=false;
}
else{
_lastview.backgroundColor=[UIColor redColor];
flag=true;
}
//转场动画--就是对某个view进行动画切换。
//1:如果是控制器之间的切换,其实window上view进行切换
CATransition *transion=[CATransition animation];
//设置转场动画的类型
transion.type=@"pageCurl";
//设置转场动画的方向
transion.subtype=@"fromLeft";
//把动画添加到某个view的图层上
[self.view.layer addAnimation:transion forKey:nil];
}
UIApplication *app=[UIApplication sharedApplication];
AppDelegate *dd=app.delegate;
MyViewController *my=[[MyViewController alloc] init];
//切换根控制器,其实把视图控制器的view在window上切换。所以在转场动画要作用在window上
dd.window.rootViewController=my;
CATransition *trans=[CATransition animation];
trans.type=@"pageCurl";
trans.subtype=@"fromTop";
[dd.window.layer addAnimation:trans forKey:nil];
[my release];
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有