ios转场动画
CAAnimation的子類,用于做轉(zhuǎn)場動(dòng)畫,能夠?yàn)閷犹峁┮瞥銎聊缓鸵迫肫聊坏膭?dòng)畫效果。iOS比Mac OS X的轉(zhuǎn)場動(dòng)畫效果少一點(diǎn)
UINavigationController就是通過CATransition實(shí)現(xiàn)了將控制器的視圖推入屏幕的動(dòng)畫效果
屬性解析:
type:動(dòng)畫過渡類型
subtype:動(dòng)畫過渡方向
startProgress:動(dòng)畫起點(diǎn)(在整體動(dòng)畫的百分比)
endProgress:動(dòng)畫終點(diǎn)(在整體動(dòng)畫的百分比)
?fade?????//交叉淡化過渡(不支持過渡方向) kCATransitionFade
?push?????//新視圖把舊視圖推出去? kCATransitionPush moveIn???//新視圖移到舊視圖上面?? kCATransitionMoveIn
?reveal???//將舊視圖移開,顯示下面的新視圖? kCATransitionReveal
?cube?????//立方體翻滾效果
?oglFlip??//上下左右翻轉(zhuǎn)效果
?suckEffect???//收縮效果,如一塊布被抽走(不支持過渡方向)
?rippleEffect?//滴水效果(不支持過渡方向)
?pageCurl?????//向上翻頁效果
?pageUnCurl???//向下翻頁效果
?cameraIrisHollowOpen??//相機(jī)鏡頭打開效果(不支持過渡方向)
?cameraIrisHollowClose?//相機(jī)鏡頭關(guān)上效果(不支持過渡方向)
*/
???
/*?過渡方向
?kCATransitionFromRight
?kCATransitionFromLeft
?kCATransitionFromBottom
//轉(zhuǎn)場動(dòng)畫--》是針對某個(gè)view的圖層進(jìn)行轉(zhuǎn)場動(dòng)畫
#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;}//轉(zhuǎn)場動(dòng)畫--就是對某個(gè)view進(jìn)行動(dòng)畫切換。//1:如果是控制器之間的切換,其實(shí)window上view進(jìn)行切換CATransition *transion=[CATransition animation];//設(shè)置轉(zhuǎn)場動(dòng)畫的類型transion.type=@"pageCurl";//設(shè)置轉(zhuǎn)場動(dòng)畫的方向transion.subtype=@"fromLeft";//把動(dòng)畫添加到某個(gè)view的圖層上[self.view.layer addAnimation:transion forKey:nil];}
原文連接:http://www.cnblogs.com/gcb999/p/3189367.html
?
/*?過渡效果?fade?????//交叉淡化過渡(不支持過渡方向) kCATransitionFade
?push?????//新視圖把舊視圖推出去? kCATransitionPush moveIn???//新視圖移到舊視圖上面?? kCATransitionMoveIn
?reveal???//將舊視圖移開,顯示下面的新視圖? kCATransitionReveal
?cube?????//立方體翻滾效果
?oglFlip??//上下左右翻轉(zhuǎn)效果
?suckEffect???//收縮效果,如一塊布被抽走(不支持過渡方向)
?rippleEffect?//滴水效果(不支持過渡方向)
?pageCurl?????//向上翻頁效果
?pageUnCurl???//向下翻頁效果
?cameraIrisHollowOpen??//相機(jī)鏡頭打開效果(不支持過渡方向)
?cameraIrisHollowClose?//相機(jī)鏡頭關(guān)上效果(不支持過渡方向)
*/
???
/*?過渡方向
?kCATransitionFromRight
?kCATransitionFromLeft
?kCATransitionFromBottom
//轉(zhuǎn)場動(dòng)畫--》是針對某個(gè)view的圖層進(jìn)行轉(zhuǎn)場動(dòng)畫
#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;}//轉(zhuǎn)場動(dòng)畫--就是對某個(gè)view進(jìn)行動(dòng)畫切換。//1:如果是控制器之間的切換,其實(shí)window上view進(jìn)行切換CATransition *transion=[CATransition animation];//設(shè)置轉(zhuǎn)場動(dòng)畫的類型transion.type=@"pageCurl";//設(shè)置轉(zhuǎn)場動(dòng)畫的方向transion.subtype=@"fromLeft";//把動(dòng)畫添加到某個(gè)view的圖層上[self.view.layer addAnimation:transion forKey:nil];}
?控制器直接切換動(dòng)畫
UIApplication *app=[UIApplication sharedApplication];AppDelegate *dd=app.delegate;MyViewController *my=[[MyViewController alloc] init];//切換根控制器,其實(shí)把視圖控制器的view在window上切換。所以在轉(zhuǎn)場動(dòng)畫要作用在window上dd.window.rootViewController=my;CATransition *trans=[CATransition animation];trans.type=@"pageCurl";trans.subtype=@"fromTop";[dd.window.layer addAnimation:trans forKey:nil];[my release];原文連接:http://www.cnblogs.com/gcb999/p/3189367.html
總結(jié)
- 上一篇: windows 加域
- 下一篇: OpenCV cvReleaseImag